]> granicus.if.org Git - php/commitdiff
Support for WSDL <operation> without <input> message
authorDmitry Stogov <dmitry@php.net>
Tue, 13 Jan 2004 07:59:13 +0000 (07:59 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 13 Jan 2004 07:59:13 +0000 (07:59 +0000)
ext/soap/TODO
ext/soap/php_sdl.c
ext/soap/soap.c

index 594260cb8ea6044196e97c20c711bd06d68635da..b662ee3c47a59e8d377547d72697532df8f969cc 100644 (file)
@@ -63,6 +63,8 @@ Encoding
 
 WSDL
 ----
++ wsdl and schema import
++ support for <opperation> without <input>
 ? support for style "rpc"/"document" encoding
 ? support for "encoded"/"literal" encoding
 ? support for "nillable" and "nil"
@@ -120,6 +122,7 @@ Transport
 + support for persistent HTTP connections (keep_alive)
 - support for HTTP compression (gzip,x-gzip,defalte)
 + support for HTTP authentication
++ HTTP Cookies support 
 - support for HTTP proxies
 - transport abstraction layer
 ? SoapAction HTTP header field
index 57423f13d92070711f7a67d80ed59321228c7685..507f5619f0babea05942f83e38e2a810935ea7c2 100644 (file)
@@ -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, &param, 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, &param, 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");
index 466a876772cd243ef151a8a097356177ea129a11..8d7318022a490f9338991f4ab2c030da285ecb37 100644 (file)
@@ -2005,7 +2005,11 @@ xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *
                        use = fnb->input.use;
                        if (style == SOAP_RPC) {
                                ns = xmlNewNs(body, fnb->input.ns, gen_ns->c);
-                               method = xmlNewChild(body, ns, function->requestName , NULL);
+                               if (function->requestName) {
+                                       method = xmlNewChild(body, ns, function->requestName, NULL);
+                               } else {
+                                       method = xmlNewChild(body, ns, function->functionName, NULL);
+                               }
                        }
                }
        } else {
@@ -2029,7 +2033,7 @@ xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *
                        use = SOAP_ENCODED;
                }
        }
-
+       
        for (i = 0;i < arg_count;i++) {
                xmlNodePtr param;
                sdlParamPtr parameter = get_param(function, NULL, i, FALSE);