]> granicus.if.org Git - php/commitdiff
Support for SOAP 1.2 RPC binding (<rpc:result>)
authorDmitry Stogov <dmitry@php.net>
Mon, 26 Jan 2004 15:13:45 +0000 (15:13 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 26 Jan 2004 15:13:45 +0000 (15:13 +0000)
ext/soap/TODO
ext/soap/php_encoding.h
ext/soap/php_packet_soap.c
ext/soap/php_sdl.c
ext/soap/soap.c

index ab232f1ad2c8220fa7380e0eeb2c738c959e12b9..efa3f150aff52b107be023fb5e524c300dd0b543 100644 (file)
@@ -13,7 +13,8 @@ SOAP
 - SOAP message MUST NOT contain Processing Instructions <?xml-stylesheet ... ?> (XML_PI_NODE)
 + SOAP 1.1 fault codes ("client","server"), SOAP 1.1 fault codes ("Sender","Receiver")
 + SOAP 1.1 Content-Type - "text/xml", SOAP 1.2 - "application/soap+xml"
-- support for SOAP 1.2 <rpc:result> (ignore it???)
++ support for SOAP 1.2 <rpc:result> (ignore it)
+- SOAP 1.2 uses the element names env:Code and env:Reason, respectively, for what used to be called faultcode and faultstring in SOAP 1.1.
 - support for SOAP headers
   - actor attribute
   - mustUnderstend attribute
index f518ca54870c08e19cfa899352aaa56ec26a6867..13f9b92a28404db1e5ff30e3cab2a5204c233482 100644 (file)
 #define WSDL_NS_PREFIX "wsdl"
 
 #define WSDL_SOAP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
-#define WSDL_SOAP12_NAMESPACE "http://www.w3.org/2003/05/soap-rpc"
-#define WSDL_SOAP12OLD_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap12/"
-#define WSDL_SOAP_NS_PREFIX "wsdlSoap"
+#define WSDL_SOAP12_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap12/"
+#define RPC_SOAP12_NAMESPACE  "http://www.w3.org/2003/05/soap-rpc"
 
 #define WSDL_HTTP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/"
 #define WSDL_HTTP12_NAMESPACE  "http://www.w3.org/2003/05/soap/bindings/HTTP/"
index 88dae3c0fb8e6f2fded99cc7c6f48f838d61b13f..327597ca0a12bcaafbe556480b6cac8570d4731c 100644 (file)
@@ -197,14 +197,17 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
                                        val = val->next;
                                }
                                if (val != NULL) {
-                                       zval *tmp;
-                                       tmp = master_to_zval(NULL, val);
-                                       if (val->name) {
-                                               add_assoc_zval(return_value, (char*)val->name, tmp);
-                                       } else {
-                                               add_next_index_zval(return_value, tmp);
+                                       if (!node_is_equal_ex(val,"result",RPC_SOAP12_NAMESPACE)) {
+                                               zval *tmp;
+
+                                               tmp = master_to_zval(NULL, val);
+                                               if (val->name) {
+                                                       add_assoc_zval(return_value, (char*)val->name, tmp);
+                                               } else {
+                                                       add_next_index_zval(return_value, tmp);
+                                               }
+                                               ++param_count;
                                        }
-                                       ++param_count;
                                        val = val->next;
                                }
                        }
index bf2d457fa6b985146760c9a2d7b7a1fe78a707cf..0077ee5a1c9df4f1a7424aaa49054307d4b3b04f 100644 (file)
@@ -312,12 +312,12 @@ static sdlPtr load_wsdl(char *struri)
                                if (address->ns && !strcmp(address->ns->href, WSDL_SOAP11_NAMESPACE)) {
                                        wsdl_soap_namespace = WSDL_SOAP11_NAMESPACE;
                                        tmpbinding->bindingType = BINDING_SOAP;
-                               } else if (address->ns && !strcmp(address->ns->href, WSDL_SOAP12OLD_NAMESPACE)) {
-                                       wsdl_soap_namespace = WSDL_SOAP12OLD_NAMESPACE;
-                                       tmpbinding->bindingType = BINDING_SOAP;
                                } else if (address->ns && !strcmp(address->ns->href, WSDL_SOAP12_NAMESPACE)) {
                                        wsdl_soap_namespace = WSDL_SOAP12_NAMESPACE;
                                        tmpbinding->bindingType = BINDING_SOAP;
+                               } else if (address->ns && !strcmp(address->ns->href, RPC_SOAP12_NAMESPACE)) {
+                                       wsdl_soap_namespace = RPC_SOAP12_NAMESPACE;
+                                       tmpbinding->bindingType = BINDING_SOAP;
                                } else if (address->ns && !strcmp(address->ns->href, WSDL_HTTP11_NAMESPACE)) {
                                        tmpbinding->bindingType = BINDING_HTTP;
                                } else if (address->ns && !strcmp(address->ns->href, WSDL_HTTP12_NAMESPACE)) {
index 5db2e984579323c2f1261e7291b41c3eeba814bc..6be76495d0510e6658ef85c309c08ba1357c9f46 100644 (file)
@@ -1728,7 +1728,7 @@ static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char
                        if (strcmp(fault_code,"Client") == 0) {
                                smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1);
                                smart_str_appendc(&code, ':');
-                               smart_str_appendl(&code,"Sencer",sizeof("Sender")-1);
+                               smart_str_appendl(&code,"Sender",sizeof("Sender")-1);
                        } else if (strcmp(fault_code,"Server") == 0) {
                                smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1);
                                smart_str_appendc(&code, ':');
@@ -1988,6 +1988,11 @@ static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_
 
                        param = seralize_parameter(parameter, ret, 0, "return", use TSRMLS_CC);
                        if (style == SOAP_RPC) {
+                               if (version == SOAP_1_2) {
+                                       xmlNs *rpc_ns = xmlNewNs(body, "http://www.w3.org/2003/05/soap-rpc", "rpc");
+                                       xmlNode *rpc_result = xmlNewChild(method, rpc_ns, "result", NULL);
+                                       xmlNodeSetContent(rpc_result,param->name);
+                               }
                                xmlAddChild(method,param);
                        } else {
                                if (function && function->binding->bindingType == BINDING_SOAP) {
@@ -2037,9 +2042,6 @@ static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_
                }
        }
 
-/* FIXME: if use="literal" SOAP-ENV:encodingStyle is not need.
-          What about arrayType?
-*/
        if (use == SOAP_ENCODED) {
                xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
                xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
@@ -2127,9 +2129,6 @@ static xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function,
                }
        }
 
-/* FIXME: if use="literal" SOAP-ENV:encodingStyle is not need.
-          What about arrayType?
-*/
        if (use == SOAP_ENCODED) {
                xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
                xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");