cvs: pear /SOAP Base.php Client.php Parser.php WSDL.php /SOAP/interop server_round2_test.php
| From: | Shane Caraveo | Date: | Mon, 10 Jun 2002 02:51:37 +0000 |
| Subject: | cvs: pear /SOAP Base.php Client.php Parser.php WSDL.php /SOAP/interop server_round2_test.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4528@lists.php.net to get a copy of this message | ||
shane Sun Jun 9 22:51:37 2002 EDT
Modified files:
/pear/SOAP Base.php Client.php Parser.php WSDL.php
/pear/SOAP/interop server_round2_test.php
Log:
document/literal support enhanced and fixed
wsdl proxy generation supports doc/lit better
doc/lit should be done, just needs testing and documenting
Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.11 pear/SOAP/Base.php:1.12 --- pear/SOAP/Base.php:1.11 Mon May 27 03:29:36 2002 +++ pear/SOAP/Base.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.11 2002/05/27 07:29:36 shane Exp $ +// $Id: Base.php,v 1.12 2002/06/10 02:51:36 shane Exp $ // require_once 'PEAR.php'; @@ -68,7 +68,7 @@ define('SOAP_LIBRARY_NAME', 'PEAR-SOAP 0.6.1'); // set schema version define('SOAP_XML_SCHEMA_VERSION', 'http://www.w3.org/2001/XMLSchema'); -define('SOAP_XML_SCHEMA_INSTANCE', 'http://www.w3.org/2001/XMLSchema-instance'); +define('SOAP_XML_SCHEMA_INSTANCE', 'http://www.w3.org/2001/XMLSchema-instance'); define('SOAP_XML_SCHEMA_1999', 'http://www.w3.org/1999/XMLSchema'); define('SOAP_SCHEMA', 'http://schemas.xmlsoap.org/wsdl/soap/'); define('SOAP_SCHEMA_ENCODING', 'http://schemas.xmlsoap.org/soap/encoding/'); @@ -78,6 +78,9 @@ define('SCHEMA_HTTP', 'http://schemas.xmlsoap.org/wsdl/http/'); define('SCHEMA_MIME', 'http://schemas.xmlsoap.org/wsdl/mime/'); define('SCHEMA_WSDL', 'http://schemas.xmlsoap.org/wsdl/'); +define('SCHEMA_DIME', 'http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/'); +define('SCHEMA_CONTENT', 'http://schemas.xmlsoap.org/ws/2002/04/content-type/'); +define('SCHEMA_REF', 'http://schemas.xmlsoap.org/ws/2002/04/reference/'); define('SOAP_DEFAULT_ENCODING', 'UTF-8'); @@ -95,7 +98,7 @@ * Common base class of all Soap lclasses * * @access public -* @version $Id: Base.php,v 1.11 2002/05/27 07:29:36 shane Exp $ +* @version $Id: Base.php,v 1.12 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ @@ -356,12 +359,14 @@ // XXX this will be slow on larger array's. Basicly, it flattens array's to allow us // to serialize multi-dimensional array's. We only do this if arrayType is set, // which will typicaly only happen if we are using WSDL - if (isset($options['flatten']) || ($arrayType && strchr($arrayType,','))) { + if (isset($options['flatten']) || ($arrayType && (strchr($arrayType,',') || strstr($arrayType,'][')))) { $numtypes = $this->_multiArrayType($value, $arrayType, $ar_size, $xmlout_value); } $array_type = $array_type_prefix = ''; if ($numtypes != 1) { + $arrayTypeQName = new QName($arrayType); + $arrayType = $arrayTypeQName->name; $array_types = array(); $array_val = NULL; @@ -419,8 +424,8 @@ $elPrefix = $this->getNamespacePrefix($elNamespace); $xmlout_name = "$elPrefix:$name"; } else { - $xmlns = " xmlns=\"$elNamespace\""; - $xmlout_name = $name; + $xmlns = " xmlns:ns1=\"$elNamespace\""; + $xmlout_name = 'ns1:'.$name; } } else { $xmlout_name = $name; @@ -654,12 +659,16 @@ } $header_xml = "<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n"; } - if (is_array($method)) { - foreach ($method as $part) { - $smsg .= $part->serialize($this); + if (!isset($options['input']) || $options['input'] == 'parse') { + if (is_array($method)) { + foreach ($method as $part) { + $smsg .= $part->serialize($this); + } + } else { + $smsg = $method->serialize($this); } - } else { - $smsg = $method->serialize($this); + } else { + $smsg = $method; } $body = "<SOAP-ENV:Body>\r\n".$smsg."\r\n</SOAP-ENV:Body>\r\n"; @@ -667,9 +676,14 @@ $ns_string .= " xmlns:$v=\"$k\"\r\n"; } + /* if use='literal', we do not put in the encodingStyle. This is denoted by + $this->section5 being false. + XXX use can be defined at a more granular level than we are dealing with + here, so this does not work for all services. + */ $xml = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n". "<SOAP-ENV:Envelope $ns_string". - ($options['style'] == 'rpc'?" SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\"":''). + ($this->section5?" SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\"":''). ">\r\n". "$header_xml$body</SOAP-ENV:Envelope>\r\n"; @@ -794,7 +808,7 @@ * class used to handle QNAME values in XML * * @access public -* @version $Id: Base.php,v 1.11 2002/05/27 07:29:36 shane Exp $ +* @version $Id: Base.php,v 1.12 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ Index: pear/SOAP/Client.php diff -u pear/SOAP/Client.php:1.32 pear/SOAP/Client.php:1.33 --- pear/SOAP/Client.php:1.32 Mon May 27 03:29:36 2002 +++ pear/SOAP/Client.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Client.php,v 1.32 2002/05/27 07:29:36 shane Exp $ +// $Id: Client.php,v 1.33 2002/06/10 02:51:36 shane Exp $ // require_once 'SOAP/Value.php'; @@ -37,7 +37,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Client.php,v 1.32 2002/05/27 07:29:36 shane Exp $ +* @version $Id: Client.php,v 1.33 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Stig Bakken <ssb@fast.no> Conversion to PEAR @@ -175,7 +175,7 @@ $this->raiseSoapFault("Don't understand the header info you provided. Must be array or SOAP_Header."); } } - + /** * SOAP_Client::call * @@ -207,15 +207,18 @@ function call($method, $params = array(), $namespace = false, $soapAction = false) { $this->fault = null; - $options = array(); - + $options = array('input'=>'parse','result'=>'parse'); + if (gettype($params) != 'array') { + $params = array($params); + } if (gettype($namespace) == 'array') { - $options = $namespace; + $options = array_merge($options,$namespace); if (isset($options['namespace'])) $namespace = $options['namespace']; else $namespace = false; } else { // we'll place soapaction into our array for usage in the transport $options['soapaction'] = $soapAction; + $options['namespace'] = $namespace; } if ($this->endpointType == 'wsdl') { @@ -237,23 +240,36 @@ // get operation data $opData = $this->wsdl->getOperationData($this->portName, $method); + if (PEAR::isError($opData)) { return $this->raiseSoapFault($opData); } + $options['style'] = $opData['style']; + $options['use'] = $opData['input']['use']; $options['soapaction'] = $opData['soapAction']; // set input params + if ($options['input'] == 'parse') { $nparams = array(); - if (count($opData['input']['parts']) > 0) { + if (isset($opData['input']['parts']) && count($opData['input']['parts']) > 0) { $i = 0; reset($params); foreach ($opData['input']['parts'] as $name => $part) { + $xmlns = ''; + $attrs = array(); + // is the name actually a complex type? + if (isset($part['element'])) { + $xmlns = $this->wsdl->namespaces[$part['namespace']]; + $part = $this->wsdl->elements[$part['namespace']][$part['type']]; + $name = $part['name']; + } if (isset($params[$name])) { $nparams[$name] = $params[$name]; } else { // XXX assuming it's an array, not a hash // XXX this is pretty pethetic, but "fixes" a problem where // paremeter names do not match correctly + $nparams[$name] = current($params); next($params); } @@ -269,11 +285,16 @@ $type_namespace = NULL; $qname->namespace = $type_namespace; $type = $qname->name; - $nparams[$name] = new SOAP_Value($name, $qname->fqn(), $nparams[$name]); + $pqname = $name; + if ($xmlns) $pqname = '{'.$xmlns.'}'.$name; + $nparams[$name] = new SOAP_Value($pqname, $qname->fqn(), $nparams[$name],$attrs); + } else { + // wsdl fixups to the soap value } } } $params = $nparams; + } } else { $this->setSchemaVersion(SOAP_XML_SCHEMA_VERSION); } @@ -284,10 +305,24 @@ if (!isset($options['style']) || $options['style'] == 'rpc') { $options['style'] = 'rpc'; + $this->docparams = true; $mqname = new QName($method, $namespace); $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params); $soap_msg = $this->_makeEnvelope($methodValue, $this->headers, $this->encoding,$options); } else { + if ($options['input'] == 'parse') { + if (is_array($params)) { + $nparams = array(); + foreach ($params as $n => $v) { + if (gettype($v) != 'object') { + $nparams[] = new SOAP_Value($n, false, $v); + } else { + $nparams[] = $v; + } + } + $params = $nparams; + } + } $soap_msg = $this->_makeEnvelope($params, $this->headers, $this->encoding,$options); } @@ -337,20 +372,20 @@ } // send the message - $response = $soap_transport->send($soap_data, $options); + $this->xml = $soap_transport->send($soap_data, $options); // save the wire information for debugging $this->wire = "OUTGOING:\n\n". $soap_transport->transport->outgoing_payload. "\n\nINCOMING\n\n". preg_replace("/></",">\r\n<",$soap_transport->transport->incoming_payload); - // store the incoming xml for easy retreival by clients that want their own parsing - $this->xml = $soap_transport->transport->incoming_payload; + + if (isset($options['result']) && $options['result'] != 'parse') return $this->xml; if ($soap_transport->fault) { - return $this->raiseSoapFault($response); + return $this->raiseSoapFault($this->xml); } - return $this->parseResponse($response, $soap_transport->result_encoding,$soap_transport->transport->attachments); + return $this->parseResponse($this->xml, $soap_transport->result_encoding,$soap_transport->transport->attachments); } function parseResponse($response, $encoding, $attachments) @@ -384,6 +419,7 @@ } if (is_array($returnArray)) { if (isset($returnArray['faultcode']) || isset($returnArray['SOAP-ENV:faultcode'])) { + $faultcode = $faultstring = $faultdetail = $faultactor = ''; foreach ($returnArray as $k => $v) { if (stristr($k,'faultcode')) $faultcode = $v; if (stristr($k,'faultstring')) $faultstring = $v; Index: pear/SOAP/Parser.php diff -u pear/SOAP/Parser.php:1.22 pear/SOAP/Parser.php:1.23 --- pear/SOAP/Parser.php:1.22 Mon May 13 02:47:09 2002 +++ pear/SOAP/Parser.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.22 2002/05/13 06:47:09 shane Exp $ +// $Id: Parser.php,v 1.23 2002/06/10 02:51:36 shane Exp $ // require_once 'SOAP/Base.php'; @@ -30,7 +30,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Parser.php,v 1.22 2002/05/13 06:47:09 shane Exp $ +* @version $Id: Parser.php,v 1.23 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Parser * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -181,15 +181,21 @@ } } } + // build attributes + $attrs = array(); + foreach ($this->message[$pos]['attrs'] as $atn => $atv) { + if (!strstr($atn, 'xmlns') && + !strpos($atn, ':')) $attrs[$atn]=$atv; + } // add current node's value if ($response) { - $nqn = new Qname($this->message[$pos]["name"],$this->message[$pos]["namespace"]); - $tqn = new Qname($this->message[$pos]["type"],$this->message[$pos]["type_namespace"]); - $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $response); + $nqn = new Qname($this->message[$pos]['name'],$this->message[$pos]['namespace']); + $tqn = new Qname($this->message[$pos]['type'],$this->message[$pos]['type_namespace']); + $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $response, $attrs); } else { - $nqn = new Qname($this->message[$pos]["name"],$this->message[$pos]["namespace"]); - $tqn = new Qname($this->message[$pos]["type"],$this->message[$pos]["type_namespace"]); - $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $this->message[$pos]['cdata']); + $nqn = new Qname($this->message[$pos]['name'],$this->message[$pos]['namespace']); + $tqn = new Qname($this->message[$pos]['type'],$this->message[$pos]['type_namespace']); + $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $this->message[$pos]['cdata'], $attrs); } // handle header attribute that we need if (array_key_exists('actor',$this->message[$pos])) { Index: pear/SOAP/WSDL.php diff -u pear/SOAP/WSDL.php:1.23 pear/SOAP/WSDL.php:1.24 --- pear/SOAP/WSDL.php:1.23 Mon May 27 03:29:36 2002 +++ pear/SOAP/WSDL.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: WSDL.php,v 1.23 2002/05/27 07:29:36 shane Exp $ +// $Id: WSDL.php,v 1.24 2002/06/10 02:51:36 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/Fault.php'; @@ -38,7 +38,7 @@ * implement IDL type syntax declaration so we can generate WSDL * * @access public -* @version $Id: WSDL.php,v 1.23 2002/05/27 07:29:36 shane Exp $ +* @version $Id: WSDL.php,v 1.24 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -89,12 +89,15 @@ } // find the name of the first port that contains an operation of name $operation + // always returns a the soap portName function getPortName($operation) { if (isset($this->services[$this->service]['ports'])) { foreach ($this->services[$this->service]['ports'] as $port => $portAttrs) { - if ($this->bindings[$portAttrs['binding']]['operations'][$operation] != '') { - return $port; + $type = $this->services[$this->service]['ports'][$port]['type']; + if ($type == 'soap' && + isset($this->bindings[$portAttrs['binding']]['operations'][$operation])) { + return $port; } } } @@ -115,15 +118,40 @@ return $this->raiseSoapFault("no port type for binding $binding in wsdl " . $this->uri); } if (is_array($this->portTypes[$portType][$operation])) { - $opData['parameterOrder'] = $this->portTypes[$portType][$operation]['parameterOrder']; + if (isset($this->portTypes[$portType][$operation]['parameterOrder'])) + $opData['parameterOrder'] = $this->portTypes[$portType][$operation]['parameterOrder']; $opData['input'] = array_merge($opData['input'], $this->portTypes[$portType][$operation]['input']); $opData['output'] = array_merge($opData['output'], $this->portTypes[$portType][$operation]['output']); } // message data from messages $inputMsg = $opData['input']['message']; - $opData['input']['parts'] = $this->messages[$inputMsg]; + foreach ($this->messages[$inputMsg] as $pname => $pattrs) { + if ($opData['style'] == 'document' && $opData['input']['use'] == 'literal' + && $pname == 'parameters') { + + $el = $this->elements[$pattrs['namespace']][$pattrs['type']]; + foreach ($el['elements'] as $elname => $elattrs) { + $opData['input']['parts'][$elname] = $elattrs; + } + + } else { + $opData['input']['parts'][$pname] = $pattrs; + } + } $outputMsg = $opData['output']['message']; - $opData['output']['parts'] = $this->messages[$outputMsg]; + foreach ($this->messages[$outputMsg] as $pname => $pattrs) { + if ($opData['style'] == 'document' && $opData['output']['use'] == 'literal' + && $pname == 'parameters') { + + $el = $this->elements[$pattrs['namespace']][$pattrs['type']]; + foreach ($el['elements'] as $elname => $elattrs) { + $opData['output']['parts'][$elname] = $elattrs; + } + + } else { + $opData['output']['parts'][$pname] = $pattrs; + } + } return $opData; } return $this->raiseSoapFault("no binding for port $portName in wsdl", $this->uri); @@ -188,7 +216,8 @@ #return false; } - function _addArg(&$args, &$argarray, $argname) { + function _addArg(&$args, &$argarray, $argname) + { if ($args) $args .= ", "; $args .= "\$".$argname; if (!$this->_validateString($argname)) return NULL; @@ -196,11 +225,61 @@ $argarray .= "\"$argname\"=>\$".$argname; } + function _elementArg(&$args, &$argarray, &$_argtype, $_argname) + { + $comments = ''; + $el = $this->elements[$_argtype['namespace']][$_argtype['type']]; + $tns = isset($this->ns[$el['namespace']])?$this->ns[$el['namespace']]:$_argtype['namespace']; + if (isset($this->complexTypes[$tns][$el['type']])) { + // the element is actually a complex type! + $comments = " // {$el['type']} is a ComplexType, refer to wsdl for more info\n"; + $attrname = "{$_argtype['type']}_attr"; + if (isset($this->complexTypes[$tns][$el['type']]['attribute'])) { + $comments .= " // {$el['type']} may require attributes, refer to wsdl for more info\n"; + } + $comments .= " \${$attrname}['xmlns'] = '{$this->namespaces[$_argtype['namespace']]}';\n"; + $comments .= " \${$_argtype['type']} = new SOAP_Value('{$_argtype['type']}',false,\${$_argtype['type']},\$$attrname);\n"; + $this->_addArg($args,$argarray,$_argtype['type']); + if (isset($this->complexTypes[$tns][$el['type']]['attribute'])) { + if ($args) $args .= ", "; + $args .= "\$".$attrname; + } + #$comments = $this->_complexTypeArg($args,$argarray,$el,$_argtype['type']); + } else if (isset($el['elements'])) { + foreach ($el['elements'] as $ename => $element) { + $comments .= " \$$ename = new SOAP_Value('{{$this->namespaces[$element['namespace']]}}$ename','{$element['type']}',\$$ename);\n"; + $this->_addArg($args,$argarray,$ename); + } + } else { + #$echoStringParam = new SOAP_Value('{http://soapinterop.org/xsd}echoStringParam',false,$echoStringParam); + $comments .= " \$$_argname = new SOAP_Value('{{$this->namespaces[$tns]}}$_argname','{$el['type']}',\$$_argname);\n"; + $this->_addArg($args,$argarray,$_argname); + } + return $comments; + } + + function _complexTypeArg(&$args, &$argarray, &$_argtype, $_argname) + { + $comments = ''; + if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']])) { + $comments = " // $_argname is a ComplexType, refer to wsdl for more info\n"; + if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']]['attribute'])) { + $comments .= " // $_argname may require attributes, refer to wsdl for more info\n"; + } + $wrapname = '{'.$this->namespaces[$_argtype['namespace']].'}'.$_argtype['type']; + $comments .= " \${$_argtype['type']} = new SOAP_Value('$wrapname',false,\${$_argtype['type']});\n"; + + } + $this->_addArg($args,$argarray,$_argname); + return $comments; + } + /** * generateProxyCode * generates stub code from the wsdl that can be saved to a file, or eval'd into existence */ - function generateProxyCode($port = '') { + function generateProxyCode($port = '') + { if (!$port) { reset($this->services[$this->service]['ports']); $port = current($this->services[$this->service]['ports']); @@ -226,6 +305,11 @@ // XXX currentPortType is BAD foreach ($this->portTypes[$portType] as $opname => $operation) { $soapaction = $this->bindings[$primaryBinding]['operations'][$opname]['soapAction']; + if (isset($this->bindings[$primaryBinding]['operations'][$opname]['style'])) { + $opstyle = $this->bindings[$primaryBinding]['operations'][$opname]['style']; + } else { + $opstyle = $style; + } $use = $this->bindings[$primaryBinding]['operations'][$opname]['input']['use']; if ($use == 'encoded') { $namespace = $this->bindings[$primaryBinding]['operations'][$opname]['input']['namespace']; @@ -238,36 +322,46 @@ $args = ''; $argarray = ''; $comments = ''; + $wrappers = ''; foreach ($operation['input'] as $argname => $argtype) { if ($argname == "message") { foreach ($this->messages[$argtype] as $_argname => $_argtype) { $comments = ''; - if (isset($_argtype['element'])) { - $el = $this->elements[$_argtype['namespace']][$_argtype['type']]; - $tns = isset($this->ns[$el['namespace']])?$this->ns[$el['namespace']]:$_argtype['namespace']; - if (isset($this->complexTypes[$tns][$el['type']])) { - // the element is actually a complex type! - $comments = " // {$el['type']} is a ComplexType, refer to wsdl for more info\n"; - if (isset($this->complexTypes[$tns][$el['type']]['attribute'])) { - $comments .= " // {$el['type']} may require attributes, refer to wsdl for more info\n"; + if ($opstyle == 'document' && $use == 'literal' && + $_argtype['name'] == 'parameters') { + // the type or element refered to is used for parameters! + $elattrs = null; + $element = $_argtype['element']; + $el = $this->elements[$_argtype['namespace']][$_argtype['type']]; + + if($el['complex']) { + $namespace = $this->namespaces[$_argtype['namespace']]; + // XXX need to wrap the parameters in a soap_value } - #$ct = $this->complexTypes[$this->ns[$el['namespace']]][$el['name']]; - $this->_addArg($args,$argarray,$el['type']); - } else if (isset($el['elements'])) { - foreach ($el['elements'] as $ename => $element) { - $this->_addArg($args,$argarray,$ename); + if (isset($el['elements'])) { + foreach ($el['elements'] as $elname => $elattrs) { + // is the element a complex type? + if (isset($this->complexTypes[$elattrs['namespace']][$elname])) { + $comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname); + } else { + $this->_addArg($args, $argarray, $elname); + } + } + }/* else { + $comments = $this->_complexTypeArg($args, $argarray, $elattrs, $elattrs['name']); + }*/ + if($el['complex'] && $argarray) { + $wrapname = '{'.$this->namespaces[$_argtype['namespace']].'}'.$el['name']; + $comments .= " \${$el['name']} = new SOAP_Value('$wrapname',false,array($argarray));\n"; + $argarray = "'{$el['name']}'=>\${$el['name']}"; } - } else { - $this->_addArg($args,$argarray,$_argname); - } + } else + if (isset($_argtype['element'])) { + // element argument + $comments = $this->_elementArg($args, $argarray, $_argtype, $_argtype['type']); } else { - if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']])) { - $comments = " // $_argname is a ComplexType, refer to wsdl for more info\n"; - if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']]['attribute'])) { - $comments .= " // $_argname may require attributes, refer to wsdl for more info\n"; - } - } - $this->_addArg($args,$argarray,$_argname); + // complex type argument + $comments = $this->_complexTypeArg($args, $argarray, $_argtype, $_argname); } } } @@ -278,8 +372,15 @@ if (!$this->_validateString($namespace)) return NULL; if (!$this->_validateString($soapaction)) return NULL; - $class .= " function $opname($args) {\n$comments". - " return \$this->call(\"$opname\", array($argarray), array('namespace'=>'$namespace', 'soapaction'=>'$soapaction','style'=>'$style','use'=>'$use')); \n". + if ($argarray) $argarray = "array($argarray)"; + else $argarray = 'NULL'; + $class .= " function $opname($args) {\n$comments$wrappers". + " return \$this->call(\"$opname\", \n". + " $argarray, \n". + " array('namespace'=>'$namespace',\n". + " 'soapaction'=>'$soapaction',\n". + " 'style'=>'$opstyle',\n". + " 'use'=>'$use')); \n". " }\n"; } $class .= "}\n"; @@ -288,9 +389,11 @@ function getProxy($port = '') { - $proxy = $this->generateProxyCode($port); - eval($proxy); $classname = 'WebService_'.$this->service; + if (!class_exists($classname)) { + $proxy = $this->generateProxyCode($port); + eval($proxy); + } return new $classname; } @@ -303,7 +406,8 @@ foreach ($this->complexTypes as $ns=> $types) { if (array_key_exists($type, $types)) { if (array_key_exists('type', $types[$type])) { - return array($types[$type]['type'],$types[$type]['arrayType'],$this->namespaces[$types[$type]['namespace']]); + $arraytype = isset($types[$type]['arrayType'])?$types[$type]['arrayType']:NULL; + return array($types[$type]['type'],$arraytype,$this->namespaces[$types[$type]['namespace']]); } if (array_key_exists('arrayType', $types[$type])) { return array('Array',$types[$type]['arrayType'],$this->namespaces[$types[$type]['namespace']]); @@ -533,6 +637,7 @@ case 'complexType': if ($parent_tag == 'schema') { $this->currentComplexType = $attrs['name']; + if (!isset($attrs['namespace'])) $attrs['namespace'] = $this->schema; $this->wsdl->complexTypes[$this->schema][$this->currentComplexType] = $attrs; if (array_key_exists('base',$attrs)) { $qn = new QName($attrs['base']); @@ -542,14 +647,17 @@ $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct'; } $this->schemaStatus = 'complexType'; + } else { + $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = TRUE; } break; case 'element': if (isset($attrs['type'])) { $qn = new QName($attrs['type']); $attrs['type'] = $qn->name; + #$this->wsdl->getNamespaceAttributeName if ($qn->ns && array_key_exists($qn->ns, $this->wsdl->namespaces)) { - $attrs['namespace'] = $this->wsdl->namespaces[$qn->ns]; + $attrs['namespace'] = $qn->ns; } } @@ -565,9 +673,11 @@ $this->currentElement = $attrs['name']; } $this->schema_element_stack[] = $this->currentElement; + if (!isset($attrs['namespace'])) $attrs['namespace'] = $this->schema; if ($parent_tag == 'schema') { $this->wsdl->elements[$this->schema][$this->currentElement] = $attrs; + $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = FALSE; $this->schemaStatus = 'element'; } else if ($this->currentComplexType) { // we're inside a complexType @@ -581,8 +691,9 @@ } break; case 'complexContent': - + case 'simpleContent': break; + case 'extension': case 'restriction': if ($this->schemaStatus == 'complexType') { if ($attrs['base']) { @@ -597,9 +708,9 @@ case 'sequence': if ($this->schemaStatus == 'complexType') { $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = 'sequence'; - if (!array_key_exists('type',$this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) { + #if (!array_key_exists('type',$this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) { $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array'; - } + #} } break; case 'all': @@ -700,12 +811,14 @@ case 'binding': // sect 3.3 // soap:binding, attributes: transport(required), style(optional, default = document) + // if style is missing, it is assumed to be 'document' if (!isset($attrs['style'])) $attrs['style'] = 'document'; $this->wsdl->bindings[$this->currentBinding] = array_merge($this->wsdl->bindings[$this->currentBinding],$attrs); break; case 'operation': // sect 3.4 // soap:operation, attributes: soapAction(required), style(optional, default = soap:binding:style) + if (!isset($attrs['style'])) $attrs['style'] = $this->wsdl->bindings[$this->currentBinding]['style']; $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = $attrs; break; case 'body': @@ -753,24 +866,13 @@ // sect 2.5 // wsdl:operation attributes: name $this->currentOperation = $attrs['name']; - // section 3.4, style defaults to the binding, overriden by soap:operation - $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = - array('style'=>$this->wsdl->bindings[$this->currentBinding]['style']); break; case 'output': - // sect 2.5 - // wsdl:input attributes: name - $this->opStatus = 'output'; - break; case 'input': - // sect 2.5 - // wsdl:input attributes: name - $this->opStatus = 'input'; - break; case 'fault': // sect 2.5 - // wsdl:fault attributes: name - $this->opStatus = 'fault'; + // wsdl:input attributes: name + $this->opStatus = $qname->name; break; case 'documentation': break; @@ -837,13 +939,27 @@ // error break; } - case 'documentation': - break; + case SCHEMA_DIME: + // DIME is defined in: + // http://gotdotnet.com/team/xml_wsspecs/dime/WSDL-Extension-for-DIME.htm + // all DIME parts are children of wsdl:input, wsdl:output, etc. + // unsuported as of yet + switch($qname->name) { + case 'message': + // sect 4.1 dime:message + // appears in binding section + $this->wsdl->bindings[$this->currentBinding]['dime'] = $attrs; + break; + default: + break; + } default: break; } break; case 'service': + $ns = $qname->ns?$this->wsdl->namespaces[strtolower($qname->ns)]:SCHEMA_WSDL; + switch($qname->name) { case 'port': // sect 2.6 wsdl:port attributes: name binding @@ -856,6 +972,20 @@ break; case 'address': $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['address'] = $attrs; + // what TYPE of port is it? SOAP or HTTP? + $ns = $qname->ns?$this->wsdl->namespaces[strtolower($qname->ns)]:SCHEMA_WSDL; + switch($ns) { + case SCHEMA_HTTP: + $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='http'; + break; + case SCHEMA_SOAP: + $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap'; + break; + default: + // shouldn't happen, we'll assume soap + $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap'; + } + break; case 'documentation': break; @@ -930,7 +1060,7 @@ if (strstr($key,'xmlns:') !== FALSE) { $qn = new QName($key); // XXX need to refactor ns handling - $this->wsdl->namespaces[$qn->name] = $value; + $this->wsdl->namespaces[strtolower($qn->name)] = $value; $this->wsdl->ns[$value] = $qn->name; if ($key == 'targetNamespace' || strcasecmp($value,SOAP_SCHEMA)==0) { Index: pear/SOAP/interop/server_round2_test.php diff -u pear/SOAP/interop/server_round2_test.php:1.5 pear/SOAP/interop/server_round2_test.php:1.6 --- pear/SOAP/interop/server_round2_test.php:1.5 Mon May 13 02:47:10 2002 +++ pear/SOAP/interop/server_round2_test.php Sun Jun 9 22:51:37 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more | // +----------------------------------------------------------------------+ // -// $Id: server_round2_test.php,v 1.5 2002/05/13 06:47:10 shane Exp $ +// $Id: server_round2_test.php,v 1.6 2002/06/10 02:51:37 shane Exp $ // require_once 'SOAP/Server.php'; @@ -27,232 +27,24 @@ require_once 'server_round2_groupB.php'; require_once 'server_round2_groupC.php'; -$test = '<?xml version="1.0"?> +$test = '<?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/echoheader/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Header> - -<ns6:echoMeStringRequest xsi:type="xsd:string" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">hello world</ns6:echoMeStringRequest> -</SOAP-ENV:Header> + xmlns:ns4="http://soapinterop.org/xsd" + xmlns:ns5="http://soapinterop.org/" + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> -<echoVoid></echoVoid> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope>'; - -$test = '<?xml version="1.0"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/echoheader/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Header> - -<ns6:echoMeStructRequest xsi:type="si:SOAPStruct" - SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" - SOAP-ENV:mustUnderstand="1"> +<ns5:echoStruct> +<inputStruct xsi:type="ns4:SOAPStruct"> <varString xsi:type="xsd:string">arg</varString> - <varInt xsi:type="xsd:int">34</varInt> - -<varFloat xsi:type="xsd:float">325.325</varFloat> -</ns6:echoMeStructRequest> -</SOAP-ENV:Header> -<SOAP-ENV:Body> - -<echoVoid></echoVoid> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> -'; - -$test = '<?xml version="1.0"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/echoheader/" - xmlns:ns7="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> - -<ns7:echoString> -<inputString xsi:type="xsd:string"></inputString> -</ns7:echoString> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> -'; -$test = '<?xml version="1.0" encoding="US-ASCII"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> -<ns6:echoVoid/> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope>'; - -$test = '<?xml version="1.0" encoding="US-ASCII"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> -<ns6:echoIntegerArray><inputIntegerArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]" SOAP-ENC:offset="[0]"><item xsi:type="xsd:int">1</item> -<item xsi:type="xsd:int">234324324</item> -<item xsi:type="xsd:int">2</item> -</inputIntegerArray> -</ns6:echoIntegerArray> +<varFloat xsi:type="xsd:float">325.325</varFloat></inputStruct></ns5:echoStruct> </SOAP-ENV:Body> </SOAP-ENV:Envelope>'; - -#$test = "<S:Envelope -#S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' -#xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' -#xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' -#xmlns:a='http://soapinterop.org/' -#xmlns:b='http://soapinterop.org/xsd' -#xmlns:XS='http://www.w3.org/2001/XMLSchema' -#xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> -#<S:Body> -#<b:SOAPStruct Enc:root='0' id='21b56c4' XI:type='b:SOAPStruct'> -#<varInt XI:type='XS:int'>1</varInt> -#<varFloat XI:type='XS:float'>2</varFloat> -#<varString XI:type='XS:string'>wilma</varString> -#</b:SOAPStruct> -#<a:echoStructArray> -#<inputStructArray XI:type='Enc:Array' Enc:arrayType='XS:anyType[3]'> -#<fred href='#21b56c4'/> -#<i href='#21b56c4'/> -#<i href='#21b56c4'/> -#</inputStructArray> -#</a:echoStructArray> -#</S:Body></S:Envelope>"; - -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructArray><inputStructArray XI:type='Enc:Array' Enc:arrayType='b:SOAPStruct[2]'><inputStruct href='#213e654'/> <inputStruct href='#21b8c4c'/> </inputStructArray> </a:echoStructArray> <b:SOAPStruct Enc:root='0' id='21b8c4c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>-1</varInt> <varFloat XI:type='XS:float'>-1</varFloat> <varString XI:type='XS:string'>lean on into the groove y'all</varString> </b:SOAPStruct> <b:SOAPStruct Enc:root='0' id='213e654' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>1073741824</varInt> <varFloat XI:type='XS:float'>-42.24</varFloat> <varString XI:type='XS:string'>pocketSOAP rocks!<g></varString> </b:SOAPStruct> </S:Body></S:Envelope>"; - -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction S:mustUnderstand='1' XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>"; -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>"; -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructAsSimpleTypes><inputStruct href='#213e59c'/> </a:echoStructAsSimpleTypes> <b:SOAPStruct Enc:root='0' id='213e59c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>42</varInt> <varString XI:type='XS:string'>Orbital</varString> <varFloat XI:type='XS:float'>-42.42</varFloat> </b:SOAPStruct> </S:Body></S:Envelope>"; - -// white mesa failures -/*$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>'; -*/ -/* -$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>'; -*/ -//$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoIntegerArray><inputIntegerArray XI:nil='true'></inputIntegerArray> </a:echoIntegerArray> </S:Body></S:Envelope>"; - -$test = '<?xml version="1.0" encoding="UTF-8"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:ns4="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> - -<ns4:echo2DStringArray> -<input2DStringArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2,3]"> -<item xsi:type="xsd:string">row0col0</item> -<item xsi:type="xsd:string">row0col1</item> -<item xsi:type="xsd:string">row0col2</item> -<item xsi:type="xsd:string">row1col0</item> -<item xsi:type="xsd:string">row1col1</item> -<item xsi:type="xsd:string">row1col2</item></input2DStringArray></ns4:echo2DStringArray> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope>'; - -$_SERVER['REQUEST_METHOD'] = "POST"; -$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_d624611fe466a88d956a205651c74fdb"'; - -$test = '--=_d624611fe466a88d956a205651c74fdb -Content-Type: text/xml; charset="UTF-8" -Content-Transfer-Encoding: base64 - -PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs -b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl -bG9wZS8iDQogIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiDQog -IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiDQog -IHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5n -LyINCiAgU09BUC1FTlY6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv -c29hcC9lbmNvZGluZy8iPg0KPFNPQVAtRU5WOkJvZHk+DQoNCjxlY2hvTWltZUF0dGFjaG1lbnQ+ -DQo8dGVzdCBocmVmPSJjaWQ6ZTZiOTg0M2JiYzUxY2JiMDAzOTk0MGVmN2VlNzY2MDMiLz48L2Vj -aG9NaW1lQXR0YWNobWVudD4NCjwvU09BUC1FTlY6Qm9keT4NCjwvU09BUC1FTlY6RW52ZWxvcGU+ -DQo= ---=_d624611fe466a88d956a205651c74fdb -Content-Disposition: attachment.php -Content-Type: text/plain -Content-Transfer-Encoding: base64 -Content-ID: <e6b9843bbc51cbb0039940ef7ee76603> - -PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP -QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw -Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh -Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs -dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K -DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv -cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ -X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn -KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp -Ow0KcHJpbnRfcigkcmVzcCk7DQpwcmludCAkY2xpZW50LT53aXJlOw0KPz4= ---=_d624611fe466a88d956a205651c74fdb--'; - -$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_a2cbb051424cc43e72d3c8c8d0b8f70e"'; -$test='--=_a2cbb051424cc43e72d3c8c8d0b8f70e -Content-Type: text/xml; charset="UTF-8" - -<?xml version="1.0" encoding="UTF-8"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> - -<echoMimeAttachment> -<test href="cid:a223fea3c35b5f0e6dedf8da75efd6b3"/></echoMimeAttachment> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> - ---=_a2cbb051424cc43e72d3c8c8d0b8f70e -Content-Disposition: attachment.php -Content-Type: text/plain -Content-Transfer-Encoding: base64 -Content-ID: <a223fea3c35b5f0e6dedf8da75efd6b3> - -PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP -QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw -Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh -Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs -dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K -DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv -cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ -X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn -KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp -Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+ ---=_a2cbb051424cc43e72d3c8c8d0b8f70e-- -'; $server->service($test, '',TRUE); print $server->response; ?>
Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.11 pear/SOAP/Base.php:1.12 --- pear/SOAP/Base.php:1.11 Mon May 27 03:29:36 2002 +++ pear/SOAP/Base.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.11 2002/05/27 07:29:36 shane Exp $ +// $Id: Base.php,v 1.12 2002/06/10 02:51:36 shane Exp $ // require_once 'PEAR.php'; @@ -68,7 +68,7 @@ define('SOAP_LIBRARY_NAME', 'PEAR-SOAP 0.6.1'); // set schema version define('SOAP_XML_SCHEMA_VERSION', 'http://www.w3.org/2001/XMLSchema'); -define('SOAP_XML_SCHEMA_INSTANCE', 'http://www.w3.org/2001/XMLSchema-instance'); +define('SOAP_XML_SCHEMA_INSTANCE', 'http://www.w3.org/2001/XMLSchema-instance'); define('SOAP_XML_SCHEMA_1999', 'http://www.w3.org/1999/XMLSchema'); define('SOAP_SCHEMA', 'http://schemas.xmlsoap.org/wsdl/soap/'); define('SOAP_SCHEMA_ENCODING', 'http://schemas.xmlsoap.org/soap/encoding/'); @@ -78,6 +78,9 @@ define('SCHEMA_HTTP', 'http://schemas.xmlsoap.org/wsdl/http/'); define('SCHEMA_MIME', 'http://schemas.xmlsoap.org/wsdl/mime/'); define('SCHEMA_WSDL', 'http://schemas.xmlsoap.org/wsdl/'); +define('SCHEMA_DIME', 'http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/'); +define('SCHEMA_CONTENT', 'http://schemas.xmlsoap.org/ws/2002/04/content-type/'); +define('SCHEMA_REF', 'http://schemas.xmlsoap.org/ws/2002/04/reference/'); define('SOAP_DEFAULT_ENCODING', 'UTF-8'); @@ -95,7 +98,7 @@ * Common base class of all Soap lclasses * * @access public -* @version $Id: Base.php,v 1.11 2002/05/27 07:29:36 shane Exp $ +* @version $Id: Base.php,v 1.12 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ @@ -356,12 +359,14 @@ // XXX this will be slow on larger array's. Basicly, it flattens array's to allow us // to serialize multi-dimensional array's. We only do this if arrayType is set, // which will typicaly only happen if we are using WSDL - if (isset($options['flatten']) || ($arrayType && strchr($arrayType,','))) { + if (isset($options['flatten']) || ($arrayType && (strchr($arrayType,',') || strstr($arrayType,'][')))) { $numtypes = $this->_multiArrayType($value, $arrayType, $ar_size, $xmlout_value); } $array_type = $array_type_prefix = ''; if ($numtypes != 1) { + $arrayTypeQName = new QName($arrayType); + $arrayType = $arrayTypeQName->name; $array_types = array(); $array_val = NULL; @@ -419,8 +424,8 @@ $elPrefix = $this->getNamespacePrefix($elNamespace); $xmlout_name = "$elPrefix:$name"; } else { - $xmlns = " xmlns=\"$elNamespace\""; - $xmlout_name = $name; + $xmlns = " xmlns:ns1=\"$elNamespace\""; + $xmlout_name = 'ns1:'.$name; } } else { $xmlout_name = $name; @@ -654,12 +659,16 @@ } $header_xml = "<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n"; } - if (is_array($method)) { - foreach ($method as $part) { - $smsg .= $part->serialize($this); + if (!isset($options['input']) || $options['input'] == 'parse') { + if (is_array($method)) { + foreach ($method as $part) { + $smsg .= $part->serialize($this); + } + } else { + $smsg = $method->serialize($this); } - } else { - $smsg = $method->serialize($this); + } else { + $smsg = $method; } $body = "<SOAP-ENV:Body>\r\n".$smsg."\r\n</SOAP-ENV:Body>\r\n"; @@ -667,9 +676,14 @@ $ns_string .= " xmlns:$v=\"$k\"\r\n"; } + /* if use='literal', we do not put in the encodingStyle. This is denoted by + $this->section5 being false. + XXX use can be defined at a more granular level than we are dealing with + here, so this does not work for all services. + */ $xml = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n". "<SOAP-ENV:Envelope $ns_string". - ($options['style'] == 'rpc'?" SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\"":''). + ($this->section5?" SOAP-ENV:encodingStyle=\"" . SOAP_SCHEMA_ENCODING . "\"":''). ">\r\n". "$header_xml$body</SOAP-ENV:Envelope>\r\n"; @@ -794,7 +808,7 @@ * class used to handle QNAME values in XML * * @access public -* @version $Id: Base.php,v 1.11 2002/05/27 07:29:36 shane Exp $ +* @version $Id: Base.php,v 1.12 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ Index: pear/SOAP/Client.php diff -u pear/SOAP/Client.php:1.32 pear/SOAP/Client.php:1.33 --- pear/SOAP/Client.php:1.32 Mon May 27 03:29:36 2002 +++ pear/SOAP/Client.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Client.php,v 1.32 2002/05/27 07:29:36 shane Exp $ +// $Id: Client.php,v 1.33 2002/06/10 02:51:36 shane Exp $ // require_once 'SOAP/Value.php'; @@ -37,7 +37,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Client.php,v 1.32 2002/05/27 07:29:36 shane Exp $ +* @version $Id: Client.php,v 1.33 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Stig Bakken <ssb@fast.no> Conversion to PEAR @@ -175,7 +175,7 @@ $this->raiseSoapFault("Don't understand the header info you provided. Must be array or SOAP_Header."); } } - + /** * SOAP_Client::call * @@ -207,15 +207,18 @@ function call($method, $params = array(), $namespace = false, $soapAction = false) { $this->fault = null; - $options = array(); - + $options = array('input'=>'parse','result'=>'parse'); + if (gettype($params) != 'array') { + $params = array($params); + } if (gettype($namespace) == 'array') { - $options = $namespace; + $options = array_merge($options,$namespace); if (isset($options['namespace'])) $namespace = $options['namespace']; else $namespace = false; } else { // we'll place soapaction into our array for usage in the transport $options['soapaction'] = $soapAction; + $options['namespace'] = $namespace; } if ($this->endpointType == 'wsdl') { @@ -237,23 +240,36 @@ // get operation data $opData = $this->wsdl->getOperationData($this->portName, $method); + if (PEAR::isError($opData)) { return $this->raiseSoapFault($opData); } + $options['style'] = $opData['style']; + $options['use'] = $opData['input']['use']; $options['soapaction'] = $opData['soapAction']; // set input params + if ($options['input'] == 'parse') { $nparams = array(); - if (count($opData['input']['parts']) > 0) { + if (isset($opData['input']['parts']) && count($opData['input']['parts']) > 0) { $i = 0; reset($params); foreach ($opData['input']['parts'] as $name => $part) { + $xmlns = ''; + $attrs = array(); + // is the name actually a complex type? + if (isset($part['element'])) { + $xmlns = $this->wsdl->namespaces[$part['namespace']]; + $part = $this->wsdl->elements[$part['namespace']][$part['type']]; + $name = $part['name']; + } if (isset($params[$name])) { $nparams[$name] = $params[$name]; } else { // XXX assuming it's an array, not a hash // XXX this is pretty pethetic, but "fixes" a problem where // paremeter names do not match correctly + $nparams[$name] = current($params); next($params); } @@ -269,11 +285,16 @@ $type_namespace = NULL; $qname->namespace = $type_namespace; $type = $qname->name; - $nparams[$name] = new SOAP_Value($name, $qname->fqn(), $nparams[$name]); + $pqname = $name; + if ($xmlns) $pqname = '{'.$xmlns.'}'.$name; + $nparams[$name] = new SOAP_Value($pqname, $qname->fqn(), $nparams[$name],$attrs); + } else { + // wsdl fixups to the soap value } } } $params = $nparams; + } } else { $this->setSchemaVersion(SOAP_XML_SCHEMA_VERSION); } @@ -284,10 +305,24 @@ if (!isset($options['style']) || $options['style'] == 'rpc') { $options['style'] = 'rpc'; + $this->docparams = true; $mqname = new QName($method, $namespace); $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params); $soap_msg = $this->_makeEnvelope($methodValue, $this->headers, $this->encoding,$options); } else { + if ($options['input'] == 'parse') { + if (is_array($params)) { + $nparams = array(); + foreach ($params as $n => $v) { + if (gettype($v) != 'object') { + $nparams[] = new SOAP_Value($n, false, $v); + } else { + $nparams[] = $v; + } + } + $params = $nparams; + } + } $soap_msg = $this->_makeEnvelope($params, $this->headers, $this->encoding,$options); } @@ -337,20 +372,20 @@ } // send the message - $response = $soap_transport->send($soap_data, $options); + $this->xml = $soap_transport->send($soap_data, $options); // save the wire information for debugging $this->wire = "OUTGOING:\n\n". $soap_transport->transport->outgoing_payload. "\n\nINCOMING\n\n". preg_replace("/></",">\r\n<",$soap_transport->transport->incoming_payload); - // store the incoming xml for easy retreival by clients that want their own parsing - $this->xml = $soap_transport->transport->incoming_payload; + + if (isset($options['result']) && $options['result'] != 'parse') return $this->xml; if ($soap_transport->fault) { - return $this->raiseSoapFault($response); + return $this->raiseSoapFault($this->xml); } - return $this->parseResponse($response, $soap_transport->result_encoding,$soap_transport->transport->attachments); + return $this->parseResponse($this->xml, $soap_transport->result_encoding,$soap_transport->transport->attachments); } function parseResponse($response, $encoding, $attachments) @@ -384,6 +419,7 @@ } if (is_array($returnArray)) { if (isset($returnArray['faultcode']) || isset($returnArray['SOAP-ENV:faultcode'])) { + $faultcode = $faultstring = $faultdetail = $faultactor = ''; foreach ($returnArray as $k => $v) { if (stristr($k,'faultcode')) $faultcode = $v; if (stristr($k,'faultstring')) $faultstring = $v; Index: pear/SOAP/Parser.php diff -u pear/SOAP/Parser.php:1.22 pear/SOAP/Parser.php:1.23 --- pear/SOAP/Parser.php:1.22 Mon May 13 02:47:09 2002 +++ pear/SOAP/Parser.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.22 2002/05/13 06:47:09 shane Exp $ +// $Id: Parser.php,v 1.23 2002/06/10 02:51:36 shane Exp $ // require_once 'SOAP/Base.php'; @@ -30,7 +30,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Parser.php,v 1.22 2002/05/13 06:47:09 shane Exp $ +* @version $Id: Parser.php,v 1.23 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Parser * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -181,15 +181,21 @@ } } } + // build attributes + $attrs = array(); + foreach ($this->message[$pos]['attrs'] as $atn => $atv) { + if (!strstr($atn, 'xmlns') && + !strpos($atn, ':')) $attrs[$atn]=$atv; + } // add current node's value if ($response) { - $nqn = new Qname($this->message[$pos]["name"],$this->message[$pos]["namespace"]); - $tqn = new Qname($this->message[$pos]["type"],$this->message[$pos]["type_namespace"]); - $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $response); + $nqn = new Qname($this->message[$pos]['name'],$this->message[$pos]['namespace']); + $tqn = new Qname($this->message[$pos]['type'],$this->message[$pos]['type_namespace']); + $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $response, $attrs); } else { - $nqn = new Qname($this->message[$pos]["name"],$this->message[$pos]["namespace"]); - $tqn = new Qname($this->message[$pos]["type"],$this->message[$pos]["type_namespace"]); - $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $this->message[$pos]['cdata']); + $nqn = new Qname($this->message[$pos]['name'],$this->message[$pos]['namespace']); + $tqn = new Qname($this->message[$pos]['type'],$this->message[$pos]['type_namespace']); + $response = new SOAP_Value($nqn->fqn(), $nqn->fqn(), $this->message[$pos]['cdata'], $attrs); } // handle header attribute that we need if (array_key_exists('actor',$this->message[$pos])) { Index: pear/SOAP/WSDL.php diff -u pear/SOAP/WSDL.php:1.23 pear/SOAP/WSDL.php:1.24 --- pear/SOAP/WSDL.php:1.23 Mon May 27 03:29:36 2002 +++ pear/SOAP/WSDL.php Sun Jun 9 22:51:36 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: WSDL.php,v 1.23 2002/05/27 07:29:36 shane Exp $ +// $Id: WSDL.php,v 1.24 2002/06/10 02:51:36 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/Fault.php'; @@ -38,7 +38,7 @@ * implement IDL type syntax declaration so we can generate WSDL * * @access public -* @version $Id: WSDL.php,v 1.23 2002/05/27 07:29:36 shane Exp $ +* @version $Id: WSDL.php,v 1.24 2002/06/10 02:51:36 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -89,12 +89,15 @@ } // find the name of the first port that contains an operation of name $operation + // always returns a the soap portName function getPortName($operation) { if (isset($this->services[$this->service]['ports'])) { foreach ($this->services[$this->service]['ports'] as $port => $portAttrs) { - if ($this->bindings[$portAttrs['binding']]['operations'][$operation] != '') { - return $port; + $type = $this->services[$this->service]['ports'][$port]['type']; + if ($type == 'soap' && + isset($this->bindings[$portAttrs['binding']]['operations'][$operation])) { + return $port; } } } @@ -115,15 +118,40 @@ return $this->raiseSoapFault("no port type for binding $binding in wsdl " . $this->uri); } if (is_array($this->portTypes[$portType][$operation])) { - $opData['parameterOrder'] = $this->portTypes[$portType][$operation]['parameterOrder']; + if (isset($this->portTypes[$portType][$operation]['parameterOrder'])) + $opData['parameterOrder'] = $this->portTypes[$portType][$operation]['parameterOrder']; $opData['input'] = array_merge($opData['input'], $this->portTypes[$portType][$operation]['input']); $opData['output'] = array_merge($opData['output'], $this->portTypes[$portType][$operation]['output']); } // message data from messages $inputMsg = $opData['input']['message']; - $opData['input']['parts'] = $this->messages[$inputMsg]; + foreach ($this->messages[$inputMsg] as $pname => $pattrs) { + if ($opData['style'] == 'document' && $opData['input']['use'] == 'literal' + && $pname == 'parameters') { + + $el = $this->elements[$pattrs['namespace']][$pattrs['type']]; + foreach ($el['elements'] as $elname => $elattrs) { + $opData['input']['parts'][$elname] = $elattrs; + } + + } else { + $opData['input']['parts'][$pname] = $pattrs; + } + } $outputMsg = $opData['output']['message']; - $opData['output']['parts'] = $this->messages[$outputMsg]; + foreach ($this->messages[$outputMsg] as $pname => $pattrs) { + if ($opData['style'] == 'document' && $opData['output']['use'] == 'literal' + && $pname == 'parameters') { + + $el = $this->elements[$pattrs['namespace']][$pattrs['type']]; + foreach ($el['elements'] as $elname => $elattrs) { + $opData['output']['parts'][$elname] = $elattrs; + } + + } else { + $opData['output']['parts'][$pname] = $pattrs; + } + } return $opData; } return $this->raiseSoapFault("no binding for port $portName in wsdl", $this->uri); @@ -188,7 +216,8 @@ #return false; } - function _addArg(&$args, &$argarray, $argname) { + function _addArg(&$args, &$argarray, $argname) + { if ($args) $args .= ", "; $args .= "\$".$argname; if (!$this->_validateString($argname)) return NULL; @@ -196,11 +225,61 @@ $argarray .= "\"$argname\"=>\$".$argname; } + function _elementArg(&$args, &$argarray, &$_argtype, $_argname) + { + $comments = ''; + $el = $this->elements[$_argtype['namespace']][$_argtype['type']]; + $tns = isset($this->ns[$el['namespace']])?$this->ns[$el['namespace']]:$_argtype['namespace']; + if (isset($this->complexTypes[$tns][$el['type']])) { + // the element is actually a complex type! + $comments = " // {$el['type']} is a ComplexType, refer to wsdl for more info\n"; + $attrname = "{$_argtype['type']}_attr"; + if (isset($this->complexTypes[$tns][$el['type']]['attribute'])) { + $comments .= " // {$el['type']} may require attributes, refer to wsdl for more info\n"; + } + $comments .= " \${$attrname}['xmlns'] = '{$this->namespaces[$_argtype['namespace']]}';\n"; + $comments .= " \${$_argtype['type']} = new SOAP_Value('{$_argtype['type']}',false,\${$_argtype['type']},\$$attrname);\n"; + $this->_addArg($args,$argarray,$_argtype['type']); + if (isset($this->complexTypes[$tns][$el['type']]['attribute'])) { + if ($args) $args .= ", "; + $args .= "\$".$attrname; + } + #$comments = $this->_complexTypeArg($args,$argarray,$el,$_argtype['type']); + } else if (isset($el['elements'])) { + foreach ($el['elements'] as $ename => $element) { + $comments .= " \$$ename = new SOAP_Value('{{$this->namespaces[$element['namespace']]}}$ename','{$element['type']}',\$$ename);\n"; + $this->_addArg($args,$argarray,$ename); + } + } else { + #$echoStringParam = new SOAP_Value('{http://soapinterop.org/xsd}echoStringParam',false,$echoStringParam); + $comments .= " \$$_argname = new SOAP_Value('{{$this->namespaces[$tns]}}$_argname','{$el['type']}',\$$_argname);\n"; + $this->_addArg($args,$argarray,$_argname); + } + return $comments; + } + + function _complexTypeArg(&$args, &$argarray, &$_argtype, $_argname) + { + $comments = ''; + if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']])) { + $comments = " // $_argname is a ComplexType, refer to wsdl for more info\n"; + if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']]['attribute'])) { + $comments .= " // $_argname may require attributes, refer to wsdl for more info\n"; + } + $wrapname = '{'.$this->namespaces[$_argtype['namespace']].'}'.$_argtype['type']; + $comments .= " \${$_argtype['type']} = new SOAP_Value('$wrapname',false,\${$_argtype['type']});\n"; + + } + $this->_addArg($args,$argarray,$_argname); + return $comments; + } + /** * generateProxyCode * generates stub code from the wsdl that can be saved to a file, or eval'd into existence */ - function generateProxyCode($port = '') { + function generateProxyCode($port = '') + { if (!$port) { reset($this->services[$this->service]['ports']); $port = current($this->services[$this->service]['ports']); @@ -226,6 +305,11 @@ // XXX currentPortType is BAD foreach ($this->portTypes[$portType] as $opname => $operation) { $soapaction = $this->bindings[$primaryBinding]['operations'][$opname]['soapAction']; + if (isset($this->bindings[$primaryBinding]['operations'][$opname]['style'])) { + $opstyle = $this->bindings[$primaryBinding]['operations'][$opname]['style']; + } else { + $opstyle = $style; + } $use = $this->bindings[$primaryBinding]['operations'][$opname]['input']['use']; if ($use == 'encoded') { $namespace = $this->bindings[$primaryBinding]['operations'][$opname]['input']['namespace']; @@ -238,36 +322,46 @@ $args = ''; $argarray = ''; $comments = ''; + $wrappers = ''; foreach ($operation['input'] as $argname => $argtype) { if ($argname == "message") { foreach ($this->messages[$argtype] as $_argname => $_argtype) { $comments = ''; - if (isset($_argtype['element'])) { - $el = $this->elements[$_argtype['namespace']][$_argtype['type']]; - $tns = isset($this->ns[$el['namespace']])?$this->ns[$el['namespace']]:$_argtype['namespace']; - if (isset($this->complexTypes[$tns][$el['type']])) { - // the element is actually a complex type! - $comments = " // {$el['type']} is a ComplexType, refer to wsdl for more info\n"; - if (isset($this->complexTypes[$tns][$el['type']]['attribute'])) { - $comments .= " // {$el['type']} may require attributes, refer to wsdl for more info\n"; + if ($opstyle == 'document' && $use == 'literal' && + $_argtype['name'] == 'parameters') { + // the type or element refered to is used for parameters! + $elattrs = null; + $element = $_argtype['element']; + $el = $this->elements[$_argtype['namespace']][$_argtype['type']]; + + if($el['complex']) { + $namespace = $this->namespaces[$_argtype['namespace']]; + // XXX need to wrap the parameters in a soap_value } - #$ct = $this->complexTypes[$this->ns[$el['namespace']]][$el['name']]; - $this->_addArg($args,$argarray,$el['type']); - } else if (isset($el['elements'])) { - foreach ($el['elements'] as $ename => $element) { - $this->_addArg($args,$argarray,$ename); + if (isset($el['elements'])) { + foreach ($el['elements'] as $elname => $elattrs) { + // is the element a complex type? + if (isset($this->complexTypes[$elattrs['namespace']][$elname])) { + $comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname); + } else { + $this->_addArg($args, $argarray, $elname); + } + } + }/* else { + $comments = $this->_complexTypeArg($args, $argarray, $elattrs, $elattrs['name']); + }*/ + if($el['complex'] && $argarray) { + $wrapname = '{'.$this->namespaces[$_argtype['namespace']].'}'.$el['name']; + $comments .= " \${$el['name']} = new SOAP_Value('$wrapname',false,array($argarray));\n"; + $argarray = "'{$el['name']}'=>\${$el['name']}"; } - } else { - $this->_addArg($args,$argarray,$_argname); - } + } else + if (isset($_argtype['element'])) { + // element argument + $comments = $this->_elementArg($args, $argarray, $_argtype, $_argtype['type']); } else { - if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']])) { - $comments = " // $_argname is a ComplexType, refer to wsdl for more info\n"; - if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']]['attribute'])) { - $comments .= " // $_argname may require attributes, refer to wsdl for more info\n"; - } - } - $this->_addArg($args,$argarray,$_argname); + // complex type argument + $comments = $this->_complexTypeArg($args, $argarray, $_argtype, $_argname); } } } @@ -278,8 +372,15 @@ if (!$this->_validateString($namespace)) return NULL; if (!$this->_validateString($soapaction)) return NULL; - $class .= " function $opname($args) {\n$comments". - " return \$this->call(\"$opname\", array($argarray), array('namespace'=>'$namespace', 'soapaction'=>'$soapaction','style'=>'$style','use'=>'$use')); \n". + if ($argarray) $argarray = "array($argarray)"; + else $argarray = 'NULL'; + $class .= " function $opname($args) {\n$comments$wrappers". + " return \$this->call(\"$opname\", \n". + " $argarray, \n". + " array('namespace'=>'$namespace',\n". + " 'soapaction'=>'$soapaction',\n". + " 'style'=>'$opstyle',\n". + " 'use'=>'$use')); \n". " }\n"; } $class .= "}\n"; @@ -288,9 +389,11 @@ function getProxy($port = '') { - $proxy = $this->generateProxyCode($port); - eval($proxy); $classname = 'WebService_'.$this->service; + if (!class_exists($classname)) { + $proxy = $this->generateProxyCode($port); + eval($proxy); + } return new $classname; } @@ -303,7 +406,8 @@ foreach ($this->complexTypes as $ns=> $types) { if (array_key_exists($type, $types)) { if (array_key_exists('type', $types[$type])) { - return array($types[$type]['type'],$types[$type]['arrayType'],$this->namespaces[$types[$type]['namespace']]); + $arraytype = isset($types[$type]['arrayType'])?$types[$type]['arrayType']:NULL; + return array($types[$type]['type'],$arraytype,$this->namespaces[$types[$type]['namespace']]); } if (array_key_exists('arrayType', $types[$type])) { return array('Array',$types[$type]['arrayType'],$this->namespaces[$types[$type]['namespace']]); @@ -533,6 +637,7 @@ case 'complexType': if ($parent_tag == 'schema') { $this->currentComplexType = $attrs['name']; + if (!isset($attrs['namespace'])) $attrs['namespace'] = $this->schema; $this->wsdl->complexTypes[$this->schema][$this->currentComplexType] = $attrs; if (array_key_exists('base',$attrs)) { $qn = new QName($attrs['base']); @@ -542,14 +647,17 @@ $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct'; } $this->schemaStatus = 'complexType'; + } else { + $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = TRUE; } break; case 'element': if (isset($attrs['type'])) { $qn = new QName($attrs['type']); $attrs['type'] = $qn->name; + #$this->wsdl->getNamespaceAttributeName if ($qn->ns && array_key_exists($qn->ns, $this->wsdl->namespaces)) { - $attrs['namespace'] = $this->wsdl->namespaces[$qn->ns]; + $attrs['namespace'] = $qn->ns; } } @@ -565,9 +673,11 @@ $this->currentElement = $attrs['name']; } $this->schema_element_stack[] = $this->currentElement; + if (!isset($attrs['namespace'])) $attrs['namespace'] = $this->schema; if ($parent_tag == 'schema') { $this->wsdl->elements[$this->schema][$this->currentElement] = $attrs; + $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = FALSE; $this->schemaStatus = 'element'; } else if ($this->currentComplexType) { // we're inside a complexType @@ -581,8 +691,9 @@ } break; case 'complexContent': - + case 'simpleContent': break; + case 'extension': case 'restriction': if ($this->schemaStatus == 'complexType') { if ($attrs['base']) { @@ -597,9 +708,9 @@ case 'sequence': if ($this->schemaStatus == 'complexType') { $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = 'sequence'; - if (!array_key_exists('type',$this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) { + #if (!array_key_exists('type',$this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) { $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array'; - } + #} } break; case 'all': @@ -700,12 +811,14 @@ case 'binding': // sect 3.3 // soap:binding, attributes: transport(required), style(optional, default = document) + // if style is missing, it is assumed to be 'document' if (!isset($attrs['style'])) $attrs['style'] = 'document'; $this->wsdl->bindings[$this->currentBinding] = array_merge($this->wsdl->bindings[$this->currentBinding],$attrs); break; case 'operation': // sect 3.4 // soap:operation, attributes: soapAction(required), style(optional, default = soap:binding:style) + if (!isset($attrs['style'])) $attrs['style'] = $this->wsdl->bindings[$this->currentBinding]['style']; $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = $attrs; break; case 'body': @@ -753,24 +866,13 @@ // sect 2.5 // wsdl:operation attributes: name $this->currentOperation = $attrs['name']; - // section 3.4, style defaults to the binding, overriden by soap:operation - $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = - array('style'=>$this->wsdl->bindings[$this->currentBinding]['style']); break; case 'output': - // sect 2.5 - // wsdl:input attributes: name - $this->opStatus = 'output'; - break; case 'input': - // sect 2.5 - // wsdl:input attributes: name - $this->opStatus = 'input'; - break; case 'fault': // sect 2.5 - // wsdl:fault attributes: name - $this->opStatus = 'fault'; + // wsdl:input attributes: name + $this->opStatus = $qname->name; break; case 'documentation': break; @@ -837,13 +939,27 @@ // error break; } - case 'documentation': - break; + case SCHEMA_DIME: + // DIME is defined in: + // http://gotdotnet.com/team/xml_wsspecs/dime/WSDL-Extension-for-DIME.htm + // all DIME parts are children of wsdl:input, wsdl:output, etc. + // unsuported as of yet + switch($qname->name) { + case 'message': + // sect 4.1 dime:message + // appears in binding section + $this->wsdl->bindings[$this->currentBinding]['dime'] = $attrs; + break; + default: + break; + } default: break; } break; case 'service': + $ns = $qname->ns?$this->wsdl->namespaces[strtolower($qname->ns)]:SCHEMA_WSDL; + switch($qname->name) { case 'port': // sect 2.6 wsdl:port attributes: name binding @@ -856,6 +972,20 @@ break; case 'address': $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['address'] = $attrs; + // what TYPE of port is it? SOAP or HTTP? + $ns = $qname->ns?$this->wsdl->namespaces[strtolower($qname->ns)]:SCHEMA_WSDL; + switch($ns) { + case SCHEMA_HTTP: + $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='http'; + break; + case SCHEMA_SOAP: + $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap'; + break; + default: + // shouldn't happen, we'll assume soap + $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap'; + } + break; case 'documentation': break; @@ -930,7 +1060,7 @@ if (strstr($key,'xmlns:') !== FALSE) { $qn = new QName($key); // XXX need to refactor ns handling - $this->wsdl->namespaces[$qn->name] = $value; + $this->wsdl->namespaces[strtolower($qn->name)] = $value; $this->wsdl->ns[$value] = $qn->name; if ($key == 'targetNamespace' || strcasecmp($value,SOAP_SCHEMA)==0) { Index: pear/SOAP/interop/server_round2_test.php diff -u pear/SOAP/interop/server_round2_test.php:1.5 pear/SOAP/interop/server_round2_test.php:1.6 --- pear/SOAP/interop/server_round2_test.php:1.5 Mon May 13 02:47:10 2002 +++ pear/SOAP/interop/server_round2_test.php Sun Jun 9 22:51:37 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more | // +----------------------------------------------------------------------+ // -// $Id: server_round2_test.php,v 1.5 2002/05/13 06:47:10 shane Exp $ +// $Id: server_round2_test.php,v 1.6 2002/06/10 02:51:37 shane Exp $ // require_once 'SOAP/Server.php'; @@ -27,232 +27,24 @@ require_once 'server_round2_groupB.php'; require_once 'server_round2_groupC.php'; -$test = '<?xml version="1.0"?> +$test = '<?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/echoheader/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Header> - -<ns6:echoMeStringRequest xsi:type="xsd:string" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">hello world</ns6:echoMeStringRequest> -</SOAP-ENV:Header> + xmlns:ns4="http://soapinterop.org/xsd" + xmlns:ns5="http://soapinterop.org/" + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> -<echoVoid></echoVoid> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope>'; - -$test = '<?xml version="1.0"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/echoheader/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Header> - -<ns6:echoMeStructRequest xsi:type="si:SOAPStruct" - SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" - SOAP-ENV:mustUnderstand="1"> +<ns5:echoStruct> +<inputStruct xsi:type="ns4:SOAPStruct"> <varString xsi:type="xsd:string">arg</varString> - <varInt xsi:type="xsd:int">34</varInt> - -<varFloat xsi:type="xsd:float">325.325</varFloat> -</ns6:echoMeStructRequest> -</SOAP-ENV:Header> -<SOAP-ENV:Body> - -<echoVoid></echoVoid> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> -'; - -$test = '<?xml version="1.0"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/echoheader/" - xmlns:ns7="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> - -<ns7:echoString> -<inputString xsi:type="xsd:string"></inputString> -</ns7:echoString> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> -'; -$test = '<?xml version="1.0" encoding="US-ASCII"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> -<ns6:echoVoid/> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope>'; - -$test = '<?xml version="1.0" encoding="US-ASCII"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:si="http://soapinterop.org/xsd" - xmlns:ns6="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> -<ns6:echoIntegerArray><inputIntegerArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]" SOAP-ENC:offset="[0]"><item xsi:type="xsd:int">1</item> -<item xsi:type="xsd:int">234324324</item> -<item xsi:type="xsd:int">2</item> -</inputIntegerArray> -</ns6:echoIntegerArray> +<varFloat xsi:type="xsd:float">325.325</varFloat></inputStruct></ns5:echoStruct> </SOAP-ENV:Body> </SOAP-ENV:Envelope>'; - -#$test = "<S:Envelope -#S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' -#xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' -#xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' -#xmlns:a='http://soapinterop.org/' -#xmlns:b='http://soapinterop.org/xsd' -#xmlns:XS='http://www.w3.org/2001/XMLSchema' -#xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> -#<S:Body> -#<b:SOAPStruct Enc:root='0' id='21b56c4' XI:type='b:SOAPStruct'> -#<varInt XI:type='XS:int'>1</varInt> -#<varFloat XI:type='XS:float'>2</varFloat> -#<varString XI:type='XS:string'>wilma</varString> -#</b:SOAPStruct> -#<a:echoStructArray> -#<inputStructArray XI:type='Enc:Array' Enc:arrayType='XS:anyType[3]'> -#<fred href='#21b56c4'/> -#<i href='#21b56c4'/> -#<i href='#21b56c4'/> -#</inputStructArray> -#</a:echoStructArray> -#</S:Body></S:Envelope>"; - -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructArray><inputStructArray XI:type='Enc:Array' Enc:arrayType='b:SOAPStruct[2]'><inputStruct href='#213e654'/> <inputStruct href='#21b8c4c'/> </inputStructArray> </a:echoStructArray> <b:SOAPStruct Enc:root='0' id='21b8c4c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>-1</varInt> <varFloat XI:type='XS:float'>-1</varFloat> <varString XI:type='XS:string'>lean on into the groove y'all</varString> </b:SOAPStruct> <b:SOAPStruct Enc:root='0' id='213e654' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>1073741824</varInt> <varFloat XI:type='XS:float'>-42.24</varFloat> <varString XI:type='XS:string'>pocketSOAP rocks!<g></varString> </b:SOAPStruct> </S:Body></S:Envelope>"; - -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction S:mustUnderstand='1' XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>"; -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>"; -#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructAsSimpleTypes><inputStruct href='#213e59c'/> </a:echoStructAsSimpleTypes> <b:SOAPStruct Enc:root='0' id='213e59c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>42</varInt> <varString XI:type='XS:string'>Orbital</varString> <varFloat XI:type='XS:float'>-42.42</varFloat> </b:SOAPStruct> </S:Body></S:Envelope>"; - -// white mesa failures -/*$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>'; -*/ -/* -$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>'; -*/ -//$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoIntegerArray><inputIntegerArray XI:nil='true'></inputIntegerArray> </a:echoIntegerArray> </S:Body></S:Envelope>"; - -$test = '<?xml version="1.0" encoding="UTF-8"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:ns4="http://soapinterop.org/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> - -<ns4:echo2DStringArray> -<input2DStringArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2,3]"> -<item xsi:type="xsd:string">row0col0</item> -<item xsi:type="xsd:string">row0col1</item> -<item xsi:type="xsd:string">row0col2</item> -<item xsi:type="xsd:string">row1col0</item> -<item xsi:type="xsd:string">row1col1</item> -<item xsi:type="xsd:string">row1col2</item></input2DStringArray></ns4:echo2DStringArray> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope>'; - -$_SERVER['REQUEST_METHOD'] = "POST"; -$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_d624611fe466a88d956a205651c74fdb"'; - -$test = '--=_d624611fe466a88d956a205651c74fdb -Content-Type: text/xml; charset="UTF-8" -Content-Transfer-Encoding: base64 - -PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs -b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl -bG9wZS8iDQogIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiDQog -IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiDQog -IHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5n -LyINCiAgU09BUC1FTlY6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv -c29hcC9lbmNvZGluZy8iPg0KPFNPQVAtRU5WOkJvZHk+DQoNCjxlY2hvTWltZUF0dGFjaG1lbnQ+ -DQo8dGVzdCBocmVmPSJjaWQ6ZTZiOTg0M2JiYzUxY2JiMDAzOTk0MGVmN2VlNzY2MDMiLz48L2Vj -aG9NaW1lQXR0YWNobWVudD4NCjwvU09BUC1FTlY6Qm9keT4NCjwvU09BUC1FTlY6RW52ZWxvcGU+ -DQo= ---=_d624611fe466a88d956a205651c74fdb -Content-Disposition: attachment.php -Content-Type: text/plain -Content-Transfer-Encoding: base64 -Content-ID: <e6b9843bbc51cbb0039940ef7ee76603> - -PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP -QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw -Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh -Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs -dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K -DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv -cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ -X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn -KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp -Ow0KcHJpbnRfcigkcmVzcCk7DQpwcmludCAkY2xpZW50LT53aXJlOw0KPz4= ---=_d624611fe466a88d956a205651c74fdb--'; - -$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_a2cbb051424cc43e72d3c8c8d0b8f70e"'; -$test='--=_a2cbb051424cc43e72d3c8c8d0b8f70e -Content-Type: text/xml; charset="UTF-8" - -<?xml version="1.0" encoding="UTF-8"?> - -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -<SOAP-ENV:Body> - -<echoMimeAttachment> -<test href="cid:a223fea3c35b5f0e6dedf8da75efd6b3"/></echoMimeAttachment> -</SOAP-ENV:Body> -</SOAP-ENV:Envelope> - ---=_a2cbb051424cc43e72d3c8c8d0b8f70e -Content-Disposition: attachment.php -Content-Type: text/plain -Content-Transfer-Encoding: base64 -Content-ID: <a223fea3c35b5f0e6dedf8da75efd6b3> - -PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP -QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw -Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh -Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs -dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K -DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv -cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ -X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn -KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp -Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+ ---=_a2cbb051424cc43e72d3c8c8d0b8f70e-- -'; $server->service($test, '',TRUE); print $server->response; ?>