Back to index

php5  5.3.10
Functions
xml_to_soap.h File Reference
#include "xmlrpc.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

XMLRPC_VALUE xml_element_to_SOAP_VALUE (xml_element *el)
XMLRPC_VALUE xml_element_to_SOAP_REQUEST (XMLRPC_REQUEST request, xml_element *el)
xml_elementSOAP_VALUE_to_xml_element (XMLRPC_VALUE node)
xml_elementSOAP_REQUEST_to_xml_element (XMLRPC_REQUEST request)

Function Documentation

Definition at line 582 of file xml_to_soap.c.

                                                                 {
       xml_element* root = xml_elem_new();

       /* safety first. */
       if (root) {
              xml_element* body = xml_elem_new();
              root->name = strdup("SOAP-ENV:Envelope");

              /* silly namespace stuff */
              Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"));
              Q_PushTail(&root->attrs, new_attr("xmlns:xsi", "http://www.w3.org/1999/XMLSchema-instance"));
              Q_PushTail(&root->attrs, new_attr("xmlns:xsd", "http://www.w3.org/1999/XMLSchema"));
              Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"));
              Q_PushTail(&root->attrs, new_attr("xmlns:si", "http://soapinterop.org/xsd"));
              Q_PushTail(&root->attrs, new_attr("xmlns:ns6", "http://testuri.org"));
              Q_PushTail(&root->attrs, new_attr("SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/"));

              /* Q_PushHead(&root->attrs, new_attr("xmlns:ks", "http://kitchen.sink.org/soap/everything/under/sun"));
                     JUST KIDDING!! :-)  ---->                ------------------------------------------------- */

              if (body) {
                     /* go ahead and serialize first... */
                     xml_element* el_serialized =  
                     SOAP_to_xml_element_worker(request, 
                                                                                    XMLRPC_RequestGetData(request));

                     /* check for fault, in which case, there is no intermediate element */
                     if (el_serialized && !strcmp(el_serialized->name, TOKEN_FAULT)) {
                            Q_PushTail(&body->children, el_serialized);
                     }
                     /* usual case: not a fault. Add Response element in between. */
                     else {
                            xml_element* rpc = xml_elem_new();

                            if (rpc) {
                                   const char* methodname = XMLRPC_RequestGetMethodName(request);
                                   XMLRPC_REQUEST_TYPE rtype = XMLRPC_RequestGetRequestType(request);

                                   /* if we are making a request, we want to use the methodname as is. */
                                   if (rtype == xmlrpc_request_call) {
                                          if (methodname) {
                                                 rpc->name = strdup(methodname);
                                          }
                                   }
                                   /* if it's a response, we append "Response". Also, given xmlrpc-epi
                                      API/architecture, it's likely that we don't have a methodname for
                                      the response, so we have to check that. */
                                   else {
                                          char buf[128];
                                          snprintf(buf, sizeof(buf), "%s%s", 
                                                               methodname ? methodname : "",
                                                               "Response");

                                          rpc->name = strdup(buf);
                                   }

                                   /* add serialized data to method call/response.
                                      add method call/response to body element */
                                   if (rpc->name) {
                                          if(el_serialized) {
                                                 if(Q_Size(&el_serialized->children) && rtype == xmlrpc_request_call) {
                                                        xml_element* iter = (xml_element*)Q_Head(&el_serialized->children);
                                                        while(iter) {
                                                               Q_PushTail(&rpc->children, iter);
                                                               iter = (xml_element*)Q_Next(&el_serialized->children);
                                                        }
                                                        xml_elem_free_non_recurse(el_serialized);
                                                 }
                                                 else {
                                                        Q_PushTail(&rpc->children, el_serialized);
                                                 }
                                          }

                                          Q_PushTail(&body->children, rpc);
                                   }
                                   else {
                                          /* no method name?!
                                             TODO: fault here...? */
                                   }
                            }
                     }
                     body->name = strdup("SOAP-ENV:Body");
                     Q_PushTail(&root->children, body);
              }
       }

       return root;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 577 of file xml_to_soap.c.

                                                          {
       return SOAP_to_xml_element_worker(NULL, node);
}

Here is the call graph for this function:

Definition at line 424 of file xml_to_soap.c.

{
       if (request) {
              return XMLRPC_RequestSetData(request, xml_element_to_SOAP_REQUEST_worker(request, NULL, NULL, NULL, el, 0));
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 418 of file xml_to_soap.c.

Here is the call graph for this function: