Page 1 of 1
stupid soap question
Posted: Tue Jul 31, 2007 7:32 pm
by yacahuma
If I need to call a web service method that has no parameters:
Code: Select all
$client = new SoapClient("http://localhost/mywsdl?WSDL");
print($client->__call(
/* SOAP Method Name */
"isServiceAvailable",
/* Parameters */
NULL
));
What do I pass instead of NULL???
Posted: Tue Jul 31, 2007 7:42 pm
by feyd
Why are you calling __call()? An empty array should suffice.
Fatal error
Posted: Tue Jul 31, 2007 8:13 pm
by yacahuma
I changed the code to
Code: Select all
$client = new SoapClient("http://localhost/ada_testing/AdaAPI?WSDL")
$client->__soapCall("isAdaAvailable", array());
and I am getting
Fatal error: Uncaught SoapFault exception: [HTTP] Unable to parse URL in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test\test.php:16 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'REPLACE_WITH_AC...', '', 1, 0) #1 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test\test.php(16): SoapClient->__soapCall('isAdaAvailable', Array) #2 {main} thrown in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test\test.php on line 16
if I do
Code: Select all
var_dump($client->__getFunctions());
I get all the functions , so at least I need the service is responding. The service is supposed to return a boolean.
The actual service is in Java.
BTW, What soap library should I be using in production environment???
There seems to be nusoap,pear, the one in php5...
Posted: Wed Aug 01, 2007 7:15 am
by Begby
nuSoap craps out in php5. I just use the one that came with php5. The big problem with the php5 client is it can't decode multipart responses without extending the class and doing a significant amount of hacking.
As for your problem, if you are using a wsdl then you don't need to use __call, you can just do this.
FOUND PROBLEM IS WSDL
Posted: Wed Aug 01, 2007 10:59 pm
by yacahuma
I found the problem. The wsdl contained a string REPLACE_WITH_ACCURATE_URL. Apparently the guy that did it forgot to put the url where the REPLACE_WITH_ACCURATE_URL was.
I changed the wsdl and it works now. I did use wsdl2php to do it.
Thank you. I did learn that I dont have to use the __call stuff