By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,348 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,348 IT Pros & Developers. It's quick & easy.

PHP5 SOAP Server how to return complex data

P: 3
PHP 5.2.2
Apache 2.2
Windows XP (dev environment)

I'm attempting to set up a soap server in PHP 5 and I've been succesfull in getting a simple function to work, the problem is I want to return more than just a simple data type and can't find much documentation on returning more complex data. Essentially I'd like to return about 5 strings of data after a the soap request is recieved. Any tips on returning complex data like arrays with the php Server implementation?

Thanks in advance for any help :)
May 11 '07 #1
Share this Question
Share on Google+
1 Reply

P: 3
Well I feel pretty dumb I was updating the wrong wsdl file :) it's actual super simple to pass multiple parameters so just incase someone runs into it you can just define multiple return parameters in your wsdl file

[HTML]<message name="getPersonResponse">
<part name="first_name" type="xsd:string"/>
<part name="last_name" type="xsd:string"/>

and in the function that handles the request return an array with key's that are the same name

[PHP]return array('first_name' => $person->getFirstName(), 'last_name' => $person->getLastName());[/PHP]

and that should work so long as your wsdl is the correct one... You can have different names for your wsdl and php you'll just have to manage them manually with the classmap
May 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.