|
Posted by AndyW on 09/03/06 07:17
Hey folks.
I am trying to get a soap wsdl service working and have a bit of a
noob php programming question for it. I'm using PHP 5.x btw.
I have written a soap server that contains a single method in the
form:
SayHelloWorld( $name ) { return "Hello " .$name; };
If I call the server directly from a soap client, it works fine, and
if I pass in bob as the parameter, I get Hello Bob back as the
response.
The code for that uses the $client= new SoapClient( location of
server ); technique.
Next, I wrote another client that uses a wsdl file that I created
(I've validated this using wsdl.exe and checked it for
wellformedness).
I create a new SOAP_WSDL object and calll generateProxy on it, then I
call the method using the getProxy() technique as in:
$test = $wsdl->getProxy();
$testResult = $test->SayHelloWorld( "bob" );
and this also works fine giving me Hello bob back as the return
param (so I am assuming my wsdl is correct).
Now the third client is where I am getting the problem. I am trying
to use the __soapCall method. However, when I call it, the return
param is:
Hello Object #4
The hello part is coming from the method call (as I have changed it in
the server to check just in case it was cached or something. But no
matter how hard I try I can't get the parameters to work - hence the
Object #4 bit. It should be 'bob'.
My code is as follows:
$client = new SoapClient( "http://a url here/wsdlfile.wsdl");
$client -> SayHelloWorld( "bob" )
Since the wsdl seems to work using the wsdl proxy method above, I
figure I am doing something noobish like incorrectly setting up the
params or reading them back again ?
Any ideas ?
Andy
Navigation:
[Reply to this message]
|