I am relatively new to Soap on “creating a service part”, so I propose any terminology that I collect in advance.
Is it possible to return a PHP array from a remote procedure processing service that was configured using the PHP class SoapServer?
I have a WSDL (built to blindly follow a tutorial) which, in particular, looks something like this:
<message name='genericString'>
<part name='Result' type='xsd:string'/>
</message>
<message name='genericObject'>
<part name='Result' type='xsd:object'/>
</message>
<portType name='FtaPortType'>
<operation name='query'>
<input message='tns:genericString'/>
<output message='tns:genericObject'/>
</operation>
</portType>
The PHP method I call is called a query and looks something like this.
public function query($arg){
$object = new stdClass();
$object->testing = $arg;
return $object;
}
It allows me to call
$client = new SoapClient("http://example.com/my.wsdl");
$result = $client->query('This is a test');
and the result dump will look something like
object(stdClass)[2]
public 'result' => string 'This is a test' (length=18)
I want to return my own PHP array / set from my request method. If I change my request method to return an array
public function query($arg) {
$object = array('test','again');
return $object;
}
It serializes to an object on the client side.
object(stdClass)[2]
public 'item' =>
array
0 => string 'test' (length=4)
1 => string 'again' (length=5)
, xsd:object WSDL. , , PHP-, Object. , xsd:, , . , ArrayObject.
WSDL. fo