Re: [SOAP] Re: Passing objects to soap server, complexType, classmap
| From: | Morgan Pyne | Date: | Sun, 18 Jun 2006 23:52:08 +0000 |
| Subject: | Re: [SOAP] Re: Passing objects to soap server, complexType, classmap | ||
| References: | 1 2 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-2312@lists.php.net to get a copy of this message | ||
Hi Michael,
Thx. The online documentation isn't terribly clear on all this and says several of the functions/objects (SoapVar, SoapParam) are for non-WSDL mode only, so I hadn't tried this. However, I just tried your suggestion but unfortunately I'm still not getting the correct object type on the server.
Your example below seems to be geared towards returning an object from the server rather than passing one to it, so here is what I tried:
- Removed references on both client and server to a classmap
- On the client, changed the method call to pass a SoapParam instead of directly passing my object i.e.
$client = new SoapClient('http://myurl.com/wsdl' );
$a = new someObj();
$b = new SoapParam($a, 'name_of_comlexType_from_WSDL');
$client->myRemoteMethod( $b );On the server, the 'myRemoteMethod()' is simply displaying the object type that it is passed. It is receiving the object as a 'StdClass', instead of a 'someObj' Is this the corrrect approach? Do I need to do anything additionally on the server side? Tusind tak, Morgan On 19/06/2006, at 10:32 AM, Michael Rasmussen wrote:
On Mon, 19 Jun 2006 10:17:06 +1200, Morgan Pyne wrote:I have defined a classmap on both the client & server for the object that I am trying to pass as a parameter.If you are building your server and client from a WSDL you do not need to use classmap. Simple wrap the response inside a SoapParam: $obj = new someObj(); return SoapParam($obj, 'name_of_comlexType_from_WSDL'); The server/client will automatically lookup the definition in the WSDL to be able to serialize or deserialize. --Hilsen/Regards Michael Rasmussen http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917 --PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php