Add new LassoSoapEnvelope constructor, lasso_soap_envelope_new_full()

The existing LassoSoapEnvelope constructors did not populate the node
with it's constituent members, namely a SOAP header (LassoSoapHeader)
and a SOAP body (LassoSoapBody). lasso_soap_envelope_new_full() allows
one to create a SOAP envelope and immediately begin to add header and
body elements.

Signed-off-by: John Dennis <jdennis@redhat.com>
License: MIT
This commit is contained in:
John Dennis 2015-05-26 12:26:56 -04:00 committed by Benjamin Dauvergne
parent 27f98071e7
commit a0909e732f
3 changed files with 58 additions and 0 deletions

View File

@ -2477,6 +2477,7 @@ LASSO_SOAP_DETAIL_GET_CLASS
<TITLE>LassoSoapEnvelope</TITLE>
LassoSoapEnvelope
lasso_soap_envelope_new
lasso_soap_envelope_new_full
lasso_soap_envelope_new_from_message
<SUBSECTION SoapBinding>
lasso_soap_envelope_add_action

View File

@ -82,6 +82,16 @@ lasso_soap_envelope_get_type()
return this_type;
}
/**
* lasso_soap_envelope_new:
*
* Creates a new #LassoSoapEnvelope with a new empty #LassoSoapBody
* member. Note, this function does not add a #LassoSoapHeader, if
* you need both headers and a body use
* lasso_soap_envelope_new_full() instead.
*
* Returns: new #LassoSoapEnvelope
**/
LassoSoapEnvelope*
lasso_soap_envelope_new(LassoSoapBody *body)
{
@ -94,6 +104,16 @@ lasso_soap_envelope_new(LassoSoapBody *body)
return envelope;
}
/**
* lasso_soap_envelope_new_from_message:
* @message: XML document
*
* Given an XML document in @message, parse it and convert it into a
* #LassoNode, then insert that #LassoNode into the body of the newly
* returned #LassoSoapEnvelope.
*
* Returns: new #LassoSoapEnvelope
**/
LassoSoapEnvelope*
lasso_soap_envelope_new_from_message(const gchar *message)
{
@ -108,3 +128,38 @@ lasso_soap_envelope_new_from_message(const gchar *message)
return envelope;
}
/**
* lasso_soap_envelope_new_full:
*
* Creates a new #LassoSoapEnvelope with new empty #LassoSoapHeader
* and #LassoSoapBody members.
*
* Returns: new #LassoSoapEnvelope
**/
LassoSoapEnvelope*
lasso_soap_envelope_new_full()
{
LassoSoapEnvelope *envelope = NULL;
LassoSoapHeader *header = NULL;
LassoSoapBody *body = NULL;
envelope = g_object_new(LASSO_TYPE_SOAP_ENVELOPE, NULL);
goto_cleanup_if_fail(envelope);
header = lasso_soap_header_new();
goto_cleanup_if_fail(header);
lasso_assign_gobject(envelope->Header, header);
body = lasso_soap_body_new();
goto_cleanup_if_fail(body);
lasso_assign_gobject(envelope->Body, body);
return envelope;
cleanup:
lasso_release_gobject(envelope);
lasso_release_gobject(header);
lasso_release_gobject(body);
return NULL;
}

View File

@ -63,6 +63,8 @@ LASSO_EXPORT LassoSoapEnvelope* lasso_soap_envelope_new(LassoSoapBody *body);
LASSO_EXPORT LassoSoapEnvelope* lasso_soap_envelope_new_from_message(const gchar *message);
LASSO_EXPORT LassoSoapEnvelope* lasso_soap_envelope_new_full(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */