1 oz C#, 2 oz PHP

Leave a comment

January 24, 2013 by Ruaan Harmzen

Thought I would add some PHP your way. Let’s say we have a C# web service (most are :)) that you want to call from PHP. Now there are ways to handle complex types returned but the easiest way is to return a string. Even then you cannot just assign the result of your C# web service to a string variable in PHP. Here’s how you do it:

#Create a new client variable and point it to your web service WSDL

$client = new SoapClient(“”);

#Assign some variables

$username = “Blah”;
$password = “Guess”;

#We pass the parameters in as an array to the method name, note that the array values must match your service input parameters exactly. Note that you append the word Result to your method name (that contains the returning array class

$result = $client->SendBackAStringResult(array(

“my_username” => $username,
“my_password” => $password

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: