Support for SOAP 1.2 RPC binding (<rpc:result>)

This commit is contained in:
Dmitry Stogov 2004-01-26 15:13:45 +00:00
parent adb3562d8e
commit fbead642ad
5 changed files with 23 additions and 21 deletions

View 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

View File

@ -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/"

View 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;
}
}

View 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)) {

View 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");