Page 1 of 1

Trying to consume a simple WCF service with PHP

Posted: Thu Oct 01, 2009 4:30 pm
by interminable
Hi,

I has a simple WCF service that echos whatever string the user has fed it as an argument.

The problem is a null value is always sent to the service as an argument, instead of what the user has actually entered.

Code: Select all

 
$client = new SoapClient("http://apservice.com/Service/WCFGateway.svc?wsdl");
$retval = $client->getmessage("some passed message");
in the example above, instead of "some passed message", apparently null is sent.
I can return values back that are set INSIDE the service, but cant feed it any.

In addition, I thought that if I returned an object say, that contains [message] and [success],
I could access it by just typing echo

Code: Select all

$retval->message;
but I can't do this. I can view the object using var_dump... it looks like this:

object(stdClass)#2 (1) {
["myCallResult"]=>
object(stdClass)#3 (1) {
["success"]=>
bool(false)
}
}

Re: Trying to consume a simple WCF service with PHP

Posted: Mon Oct 05, 2009 3:22 pm
by interminable
the comments on the documentation explain most everything pretty well.
http://us2.php.net/manual/en/soapclient.soapcall.php

Specifically, if it's a .net call the variable name must be included

$result = $client->someFunction('var'=>34); etc