jcworking2000 Posted October 1, 2009 Share Posted October 1, 2009 hi all, i am new to php and web service but i am trying to connect to a database using web services in php, i am able to add the web service to my page but just wondering how to capture the response and display it? in the following code, it suppose to print out "hello world". thanks for your help in advance. $xml = "<Process_MM_Test>Hello World</Process_MM_Test>"; ini_set('soap.wsdl_cache_enabled', 0); $client = new SoapClient("xxx.asmx?wsdl"); $response = $client->__soapCall("Process_MM_Test", array("xml_formatted_string" => $xml)); thanks Quote Link to comment Share on other sites More sharing options...
flyhoney Posted October 1, 2009 Share Posted October 1, 2009 Looking at the documentation (http://us.php.net/manual/en/soapclient.soapcall.php) it looks like __soapCall should return either a simple value or a associative array. To see what is being returned by __soapCall, do this: $xml = "<Process_MM_Test>Hello World</Process_MM_Test>"; ini_set('soap.wsdl_cache_enabled', 0); $client = new SoapClient("xxx.asmx?wsdl"); $response = $client->__soapCall("Process_MM_Test", array("xml_formatted_string" => $xml)); print_r($response); Quote Link to comment Share on other sites More sharing options...
jcworking2000 Posted October 1, 2009 Author Share Posted October 1, 2009 Thanks for your reply. i try to print it out but it display this stdClass Object ( ) please help. i think it's almost there. Thanks and have a great day. Quote Link to comment Share on other sites More sharing options...
akitchin Posted October 1, 2009 Share Posted October 1, 2009 it looks like you're getting an error then. from the documentation: On error, if the SoapClient object was constructed with the trace option set to FALSE, a SoapFault object will be returned. Quote Link to comment Share on other sites More sharing options...
jcworking2000 Posted October 1, 2009 Author Share Posted October 1, 2009 I have try both, true & false, still get the same result..... --- any idea? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.