mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Support for WSDL <operation> without <input> message
This commit is contained in:
parent
964d9c586d
commit
51c86ab73f
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
param->paramName = strdup(name->children->content);
|
||||
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);
|
||||
|
||||
element = get_attribute(part->properties, "element");
|
||||
if (element != NULL) {
|
||||
param->encode = get_encoder_from_prefix(ctx.root, part, element->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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
zend_hash_next_index_insert(function->requestParameters, ¶m, sizeof(sdlParamPtr), NULL);
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user