diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-01-13 07:59:13 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-01-13 07:59:13 +0000 |
commit | 51c86ab73f7d61f547593afbd6edd5f3f022f9ba (patch) | |
tree | d977c6442be93d87ef95ff0eb4d84459890a7667 /ext/soap/php_sdl.c | |
parent | 964d9c586d4713b86862817efb5fc81aef3f1325 (diff) | |
download | php-git-51c86ab73f7d61f547593afbd6edd5f3f022f9ba.tar.gz |
Support for WSDL <operation> without <input> message
Diffstat (limited to 'ext/soap/php_sdl.c')
-rw-r--r-- | ext/soap/php_sdl.c | 137 |
1 files changed, 70 insertions, 67 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 57423f13d9..507f5619f0 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -898,6 +898,7 @@ sdlPtr load_wsdl(char *struri) function->requestParameters = NULL; function->responseParameters = NULL; function->responseName = NULL; + function->requestName = NULL; function->bindingAttributes = NULL; function->bindingType = tmpbinding->bindingType; @@ -937,89 +938,91 @@ sdlPtr load_wsdl(char *struri) char *ns, *ctype; portTypeInput = get_node(portTypeOperation->children, "input"); - message = get_attribute(portTypeInput->properties, "message"); - if (message == NULL) { - php_error(E_ERROR, "Error parsing wsdl (Missing name for \"input\" of \"%s\")", op_name->children->content); - } + if (portTypeInput) { + message = get_attribute(portTypeInput->properties, "message"); + if (message == NULL) { + php_error(E_ERROR, "Error parsing wsdl (Missing name for \"input\" of \"%s\")", op_name->children->content); + } - function->requestName = strdup(function->functionName); - function->requestParameters = malloc(sizeof(HashTable)); - zend_hash_init(function->requestParameters, 0, NULL, delete_paramater, 1); + function->requestName = strdup(function->functionName); + function->requestParameters = malloc(sizeof(HashTable)); + zend_hash_init(function->requestParameters, 0, NULL, delete_paramater, 1); + + parse_namespace(message->children->content, &ctype, &ns); - parse_namespace(message->children->content, &ctype, &ns); + if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) { + php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content); + } + msgInput = *tmp; + + if (ctype) {efree(ctype);} + if (ns) {efree(ns);} + + if (tmpbinding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes; + xmlNodePtr body; + xmlAttrPtr tmp; + + body = get_node_ex(input->children, "body", WSDL_SOAP_NAMESPACE); + if (body) { + tmp = get_attribute(body->properties, "use"); + if (tmp && !strcmp(tmp->children->content, "literal")) { + soapFunctionBinding->input.use = SOAP_LITERAL; + } else { + soapFunctionBinding->input.use = SOAP_ENCODED; + } + + tmp = get_attribute(body->properties, "namespace"); + if (tmp) { + soapFunctionBinding->input.ns = strdup(tmp->children->content); + } + + tmp = get_attribute(body->properties, "parts"); + if (tmp) { + soapFunctionBinding->input.parts = strdup(tmp->children->content); + } + + tmp = get_attribute(body->properties, "encodingStyle"); + if (tmp) { + soapFunctionBinding->input.encodingStyle = strdup(tmp->children->content); + } + } + } - if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) { - php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content); - } - msgInput = *tmp; + trav3 = msgInput->children; + FOREACHNODE(trav3, "part", part) { + xmlAttrPtr element, type, name; + sdlParamPtr param; - if (ctype) {efree(ctype);} - if (ns) {efree(ns);} + param = malloc(sizeof(sdlParam)); + param->order = 0; - if (tmpbinding->bindingType == BINDING_SOAP) { - sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes; - xmlNodePtr body; - xmlAttrPtr tmp; - - body = get_node_ex(input->children, "body", WSDL_SOAP_NAMESPACE); - if (body) { - tmp = get_attribute(body->properties, "use"); - if (tmp && !strcmp(tmp->children->content, "literal")) { - soapFunctionBinding->input.use = SOAP_LITERAL; - } else { - soapFunctionBinding->input.use = SOAP_ENCODED; + name = get_attribute(part->properties, "name"); + if (name == NULL) { + php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgInput->name); } - tmp = get_attribute(body->properties, "namespace"); - if (tmp) { - soapFunctionBinding->input.ns = strdup(tmp->children->content); - } + param->paramName = strdup(name->children->content); - tmp = get_attribute(body->properties, "parts"); - if (tmp) { - soapFunctionBinding->input.parts = strdup(tmp->children->content); + element = get_attribute(part->properties, "element"); + if (element != NULL) { + param->encode = get_encoder_from_prefix(ctx.root, part, element->children->content); } - tmp = get_attribute(body->properties, "encodingStyle"); - if (tmp) { - soapFunctionBinding->input.encodingStyle = strdup(tmp->children->content); + type = get_attribute(part->properties, "type"); + if (type != NULL) { + param->encode = get_encoder_from_prefix(ctx.root, part, type->children->content); } - } - } - - trav3 = msgInput->children; - FOREACHNODE(trav3, "part", part) { - xmlAttrPtr element, type, name; - sdlParamPtr param; - - param = malloc(sizeof(sdlParam)); - param->order = 0; - - name = get_attribute(part->properties, "name"); - if (name == NULL) { - php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgInput->name); - } - - param->paramName = strdup(name->children->content); - element = get_attribute(part->properties, "element"); - if (element != NULL) { - param->encode = get_encoder_from_prefix(ctx.root, part, element->children->content); + zend_hash_next_index_insert(function->requestParameters, ¶m, sizeof(sdlParamPtr), NULL); } - - type = get_attribute(part->properties, "type"); - if (type != NULL) { - param->encode = get_encoder_from_prefix(ctx.root, part, type->children->content); - } - - zend_hash_next_index_insert(function->requestParameters, ¶m, sizeof(sdlParamPtr), NULL); + ENDFOREACH(trav3); } - ENDFOREACH(trav3); - } - paramOrder = get_attribute(portTypeOperation->properties, "parameterOrder"); - if (paramOrder) { + paramOrder = get_attribute(portTypeOperation->properties, "parameterOrder"); + if (paramOrder) { + } } output = get_node(portTypeOperation->children, "output"); |