The code bellow works fine. But just i used the client in wsdl-mode, like this: $service = new SoapClient('http://localhost/Result.php? wsdl'); In this case the function 'getResult' didn't get the value of $input variable. The soap-envelope sent was:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/ envelope/" xmlns:ns1="http://Result"> <SOAP-ENV:Body><ns1:getResult/></SOAP-ENV:Body> </SOAP-ENV:Envelope> and the return was: array 0 => string 'getResultResponse getResult(getResult $getResultRequest)' (length=60) object(stdClass)[2] public 'getResultReturn' => string 'Result:' (length=6) Pay attention in the soap-envelope the $input was not sent. Now, when i tried to use the non-wsdl mode like this: $service = new SoapClient(null, array("location" => "http://localhost/ Result.php?wsdl", "uri" => "http://Result")); the envelope sent was: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/ envelope/" xmlns:ns1="http://Result" 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> <ns1:getResult> <param0 xsi:type="xsd:string">test</param0> </ns1:getResult> </SOAP-ENV:Body> </SOAP-ENV:Envelope> and the return was..... SoapFault Object ( [message:protected] => looks like we got no XML document [string:private] => [code:protected] => 0 [file:protected] => /localhost/client.php [line:protected] => 23 [trace:private] => Array ( [0] => Array ( [file] => /localhost/client.php [line] => 23 [function] => __soapCall [class] => SoapClient [type] => -> [args] => Array ( [0] => getResult [1] => Array ( [0] => test ) ) ) ) [faultstring] => looks like we got no XML document [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ ) and I note that the function getResult was never call (i track it with error_log())!!! Anyone help me? //Result.php <?php global $HTTP_RAW_POST_DATA; if(!$HTTP_RAW_POST_DATA) { $f = file("php://input"); $HTTP_RAW_POST_DATA = implode(" ", $f); } require 'SCA/SCA.php'; /** * @service * @binding.soap */ class Result { /** * * @param string $input * @return string $output */ function getResult($input) { return "Result: $input"; } } ?> // client.php <?php $service = new SoapClient('http://localhost/Result.php?wsdl'); try { $return = $service->getResult('test'); echo "<pre>"; echo var_dump($return); echo "</pre>"; } catch (SoapFault $soapFault) { echo "<pre>"; echo var_dump($soapFault); echo "</pre>"; echo "Request :<br>"; echo "<pre>"; echo print_r(htmlentities($service->__getLastRequest())); echo "</pre>"; echo "Response :<br>"; echo "<pre>"; echo print_r(htmlentities($service->__getLastResponse())); echo "</pre>"; } ?> On 18 Mar, 10:12, Caroline Maynard <[EMAIL PROTECTED]> wrote: > Matthew Peters wrote: > > Hi, thanks for this info. This is interesting. I do not quite know > > what is going on. > > > However, at the bottom of ...../PEAR/SCA/Bindings/soap/ > > ServiceRequestHandler.php you'll see the lines: > > global $HTTP_RAW_POST_DATA; > > $server->handle($HTTP_RAW_POST_DATA); > > > This is where we pick up the raw post data and pass it in to the Soap > > Server. We already had to change this once before when something > > changed inside the Soap Server, perhaps something has changed again. > > Anyway, perhaps if you include your test and assignment from php://input > > into our ServiceRequestHandler.php it will work. > > There's a php.ini directive which is relevant to this behaviour: > always_populate_raw_post_data > > Might be worth experimenting with, but I wonder if it would be a > performance hit. I agree with Matthew that using php://input directly in > the service request handler is the way to go. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "phpsoa" group. To post to this group, send email to phpsoa@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en -~----------~----~----~----~------~----~------~--~---