Re: Re: Passing objects to soap server, complexType, classmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 19 Jun 2006 11:52:08 +1200, Morgan Pyne wrote:

> 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.
> 
I agree, the documentation could need some brush-up.
> 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:
> 
Actually it is for both server and client. Read more later.

> - 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?
> 

This is perfectly normal due to the fact that PHP is not a statical typed
language. Had you tried implementing the client in C++ or C# the server
would have serialized the SoapParam to a native C++ or C# class. In PHP
you have to do this yourself, Eg. you must provide a private method in the
server class which is capable of converting from a standard class to the
required class: 

1) 
   a) $myObj = new MyObj();
   b) $myObj->import(stdClass $a);

2) a) $myObj = MyObj::import(stdClass $a);

When dealing with WSDL I would recommend you to always try your WSDL in a
WSDL parser like:

1) Mono: wsdl <WSDL file>
2) C++/gsoap: wsdl2h <WSDL file>

Or perhaps have a look at this: http://jool.nl/new/

-- 
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


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux