![]() |
C library for SOAP (Simple Object Access Protocol) |
Go to the source code of this file.
Data Structures | |
| struct | SoapEnv |
Typedefs | |
| typedef void(* | XmlSerializerCallback )(void *obj, const xmlChar *root_element_name, void(*OnStartElement)(const xmlChar *element_name, int attr_count, xmlChar **keys, xmlChar **values, void *userData), void(*OnCharacters)(const xmlChar *element_name, const xmlChar *chars, void *userData), void(*OnEndElement)(const xmlChar *element_name, void *userData), void *userdata) |
Functions | |
| herror_t | soap_env_new_with_fault (int faultCode, const char *faultString, const char *faultActor, const char *detail, struct SoapEnv **out) |
| herror_t | soap_env_new_with_method (const char *urn, const char *method, struct SoapEnv **out) |
| herror_t | soap_env_new_with_response (struct SoapEnv *req, struct SoapEnv **out) |
| herror_t | soap_env_new_from_doc (xmlDocPtr doc, struct SoapEnv **out) |
| herror_t | soap_env_new_from_buffer (const char *buffer, struct SoapEnv **out) |
| xmlNodePtr | soap_env_add_item (struct SoapEnv *env, const char *type, const char *name, const char *value) |
| xmlNodePtr | soap_env_add_attachment (struct SoapEnv *env, const char *name, const char *href) |
| void | soap_env_add_custom (struct SoapEnv *env, void *obj, XmlSerializerCallback cb, const char *type, const char *name) |
| xmlNodePtr | soap_env_add_itemf (struct SoapEnv *env, const char *type, const char *name, const char *value,...) |
| xmlNodePtr | soap_env_push_item (struct SoapEnv *env, const char *type, const char *name) |
| void | soap_env_pop_item (struct SoapEnv *env) |
| void | soap_env_free (struct SoapEnv *env) |
| xmlNodePtr | soap_env_get_body (struct SoapEnv *env) |
| xmlNodePtr | soap_env_get_method (struct SoapEnv *env) |
| xmlNodePtr | soap_env_get_fault (struct SoapEnv *env) |
| xmlNodePtr | soap_env_get_header (struct SoapEnv *env) |
| const char * | soap_env_find_urn (struct SoapEnv *env) |
| const char * | soap_env_find_methodname (struct SoapEnv *env) |
The grammar rules are as follows:
The attribute value is an ordered list of one or more URIs identifying the serialization rule or rules that can be used to deserialize the SOAP message indicated in the order of most specific to least specific. Examples of values are:
| typedef void(* XmlSerializerCallback)(void *obj, const xmlChar *root_element_name, void(*OnStartElement)(const xmlChar *element_name, int attr_count, xmlChar **keys, xmlChar **values, void *userData), void(*OnCharacters)(const xmlChar *element_name, const xmlChar *chars, void *userData), void(*OnEndElement)(const xmlChar *element_name, void *userData), void *userdata) |
| xmlNodePtr soap_env_add_attachment | ( | struct SoapEnv * | env, | |
| const char * | name, | |||
| const char * | href | |||
| ) |
Adds attachment href node to the envelope current parent.
<m:[name] href=[href]/>
| env | The envelope object | |
| name | Name of the xml node | |
| href | href. A CID string filled by soap_ctx_add_attachment() |
| void soap_env_add_custom | ( | struct SoapEnv * | env, | |
| void * | obj, | |||
| XmlSerializerCallback | cb, | |||
| const char * | type, | |||
| const char * | name | |||
| ) |
Serialize and adds obj to the envelope. TODO: Document this function !
Important:
| xmlNodePtr soap_env_add_item | ( | struct SoapEnv * | env, | |
| const char * | type, | |||
| const char * | name, | |||
| const char * | value | |||
| ) |
Adds a new xml node under the current parent.
<m:[name] type=[type]>[value]</m:[name]>
| env | The envelope object | |
| type | Type of the parameter. Something like "xsd:string" or "xsd:int" or custom types. | |
| name | Name of the xml node | |
| value | Text value of the xml node |
| xmlNodePtr soap_env_add_itemf | ( | struct SoapEnv * | env, | |
| const char * | type, | |||
| const char * | name, | |||
| const char * | value, | |||
| ... | ||||
| ) |
Same as soap_env_add_item() with c style arguments like in printf(). "value" is the format string.
Important: The totally length of value (incl. args) must be lower the 1054.
| const char* soap_env_find_methodname | ( | struct SoapEnv * | env | ) |
Get the method of the message.
| const char* soap_env_find_urn | ( | struct SoapEnv * | env | ) |
Get the URN of the message.
| void soap_env_free | ( | struct SoapEnv * | env | ) |
Free the envelope.
| env | The envelope object |
| xmlNodePtr soap_env_get_body | ( | struct SoapEnv * | env | ) |
Gets the xml node pointing to SOAP Body.
| xmlNodePtr soap_env_get_fault | ( | struct SoapEnv * | env | ) |
Get the xml node pointing to SOAP Fault
| xmlNodePtr soap_env_get_header | ( | struct SoapEnv * | env | ) |
Get the xml node pointing to SOAP Header
| xmlNodePtr soap_env_get_method | ( | struct SoapEnv * | env | ) |
Get the xml node pointing to SOAP method (call)
Create an envelop object from a string. The string must be in xml format.
| buffer | The string to parse into a envelope. | |
| out | the output envelope object |
Creates an envelope from a given libxml2 xmlDocPtr.
| doc | the xml document pointer | |
| out | the output envelope object |
| herror_t soap_env_new_with_fault | ( | int | faultCode, | |
| const char * | faultString, | |||
| const char * | faultActor, | |||
| const char * | detail, | |||
| struct SoapEnv ** | out | |||
| ) |
Creates an envelope with a fault object.
| faultcode | The fault code |
| faultstring | A fault message | |
| faultactor | The fault actor (This can be NULL) | |
| detail | The detail of the error (This can be NULL) | |
| out | the result envelope out parameter like follows |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
xmlns:xsi="..."
xmlns:xsd="...">
<SOAP-ENV:Body>
<Fault> <faultcode>...</faultcode> <faultstring>...</faultstring> <faultactor>...</faultactor> <faultdetail>..</faultdetail> </Fault>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
Creates an envelope with a method to invoke a soap service. Use this function to create a client call.
| urn | The urn of the soap service to invoke | |
| method | The method name of the soap service | |
| out | the result envelope out parameter like follows |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
xmlns:xsi="..."
xmlns:xsd="...">
<SOAP-ENV:Body>
<m:[method] xmlns:m="[urn]">
</m:[method]>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
Creates a soap envelope with a response. Use this function to create a response envelope object for a request. This function is only relevant for soap service implementors.
| req | The request object. A response object will be created to this request. | |
| out | the result envelope out paramter like follows |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
xmlns:xsi="..."
xmlns:xsd="...">
<SOAP-ENV:Body>
<m:[req-method]Response xmlns:m="[req-urn]">
</m:[req-method]>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
| void soap_env_pop_item | ( | struct SoapEnv * | env | ) |
Sets the xml pointer 1 level higher.
| env | The envelope object |
| xmlNodePtr soap_env_push_item | ( | struct SoapEnv * | env, | |
| const char * | type, | |||
| const char * | name | |||
| ) |
Push the current xml node in the soap envelope one level deeper. Here an example:
soap_env_push_item(env, "my:custom", "Person"); soap_env_add_item(env, "xsd:string", "name", "Mickey"); soap_env_add_item(env, "xsd:string", "lastname", "Mouse"); soap_env_pop_item(env);
This will create the xml like follows.
<Person type="my:custom"> <name>Mickey</name> <lastname>Mouse</lastname> </Person>