Consuming .Net web 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
mattward1979
Forum Newbie
Posts: 5
Joined: Fri Mar 04, 2011 10:11 am

Consuming .Net web service with php

Post by mattward1979 »

Hey there!

My first post here so please be gentle =)

For a Uni project, I have to consume .net web services in php.. the web service is active and works just fine in testing (currently its just the Hello world service!), but when I try to access it from my php script, I get errors.


c# web service:

[WebMethod]
public string HelloWorld()
{
return "Hello World";
}

PHP that calls this:

Code: Select all

$client = new SoapClient('(removed)/wm815/dotnet/WAT/Service1.asmx?WSDL');
$xmlString = $client->HelloWorld();	
$xmlDom2 = new DOMDocument('1.0', 'UTF-8');
$xmlDom2->xmlStandalone = false;
$xmlDom2->loadXML($xmlString);
the Error:

Warning: DOMDocument::loadXML() expects parameter 1 to be string, object given in /home/wm815/public_html/portal1.php on line 118


I am struggling to understand what is going wrong as the return from the test of the Service is an XML document, being saved as an XML document!

Any help would be gratefully received!
Post Reply