diff --git a/src/nusoap.php b/src/nusoap.php index dcc8fc4..ee66d51 100755 --- a/src/nusoap.php +++ b/src/nusoap.php @@ -7599,7 +7599,7 @@ function __construct($endpoint, $wsdl = false, $proxyhost = false, $proxyport = * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array * @param boolean $rpcParams optional (no longer used) * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) + * @param string $use optional (encoded|literal|literal wrapped) the use when serializing parameters (WSDL can override) * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors * @access public */ @@ -7615,6 +7615,8 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org', $this->faultcode = ''; $this->opData = array(); + $usewrapped = false; + $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); $this->appendDebug('params=' . $this->varDump($params)); $this->appendDebug('headers=' . $this->varDump($headers)); @@ -7688,6 +7690,16 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org', $nsPrefix = 'ns' . rand(1000, 9999); // serialize $payload = ''; + + if ($use = 'literal wrapped') { + // 'literal wrapped' is only sensible (and defined) for 'document'. + if ($style == 'document') { + $usewrapped = true; + } + // For compatibility with the rest of the code: + $use = 'literal'; + } + if (is_string($params)) { $this->debug("serializing param string for operation $operation"); $payload = $params; @@ -7708,6 +7720,22 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org', $encodingStyle = ''; } } + + // wrap document/literal wrapped calls with operation element + if ($usewrapped) { + // (This code block was based on http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/ + // and tailored to the needs of one specific SOAP server, where no nsPrefix was seen... + $this->debug("wrapping document request with literal method element"); + + if ($namespace) { + $payload = "<$operation xmlns=\"$namespace\">" . + $payload . + ""; + } else { + $payload = "<$operation>" . $payload . ""; + } + } + // wrap RPC calls with method element if ($style == 'rpc') { if ($use == 'literal') {