Trying to consume a simple WCF service with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
interminable
Forum Newbie
Posts: 8
Joined: Thu Oct 01, 2009 4:22 pm

Trying to consume a simple WCF service with PHP

Post 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)
}
}
interminable
Forum Newbie
Posts: 8
Joined: Thu Oct 01, 2009 4:22 pm

Re: Trying to consume a simple WCF service with PHP

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