From: Dmitry Stogov Date: Mon, 26 Jan 2004 15:13:45 +0000 (+0000) Subject: Support for SOAP 1.2 RPC binding () X-Git-Tag: php-5.0.0b4RC1~298 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbead642ad2cf31d4295cbbce503abbbdc214c3c;p=php Support for SOAP 1.2 RPC binding () --- diff --git a/ext/soap/TODO b/ext/soap/TODO index ab232f1ad2..efa3f150af 100644 --- a/ext/soap/TODO +++ b/ext/soap/TODO @@ -13,7 +13,8 @@ SOAP - SOAP message MUST NOT contain Processing Instructions (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 (ignore it???) ++ support for SOAP 1.2 (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 diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h index f518ca5487..13f9b92a28 100644 --- a/ext/soap/php_encoding.h +++ b/ext/soap/php_encoding.h @@ -129,9 +129,8 @@ #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/" diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index 88dae3c0fb..327597ca0a 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -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; } } diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index bf2d457fa6..0077ee5a1c 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -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)) { diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 5db2e98457..6be76495d0 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -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");