What type does a PHP SOAP client call return?

时间:2017-08-04 13:04:23

标签: php soap-client

The PHP manual pages for the SOAP client don't clearly define what you can expect to be returned after making a call. The documentation for the soapCall method says

Usually, in WSDL mode, SOAP functions can be called as methods of the SoapClient object

But I was unable to find information about return types within the SoapClient documentation.

soapCall itelf documents a return type of a simple value or an associative array. However when I test, I get an object or type stdClass.

Can I rely on receiving an object of type stdClass?

1 个答案:

答案 0 :(得分:0)

Soapclient::soapCall() is calling ::__call() which is a magic method docs

But basically it relays the call to an internal function call of the soap client. So the ouput depends on what the function you called outputs.

Example on the docs:

<?php

$client = new SoapClient("some.wsdl");
$client->SomeFunction($a, $b, $c);

$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c), NULL,
                    new SoapHeader(), $output_headers);