Consuming .Net web service with php
Posted: Fri Mar 04, 2011 10:20 am
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:
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!
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);
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!