note 105226 added to class.soapclient
| From: | egiardina at badatmath dot com | Date: | Thu, 04 Aug 2011 01:05:31 +0000 |
| Subject: | note 105226 added to class.soapclient | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182201@lists.php.net to get a copy of this message | ||
This one drove me nuts... if you are connecting to a web service run on Cassini, (Visual
Studio's web server) from php, you may not be able to call web service functions or load a WSDL
out-of-the-box.
My set up is that I am using xampp on my windows development machine, and also using Visual
Studio's built in web-server. I built a web service in visual studio. I wrote a simple PHP
script, running under xampp, to access this service, so the two projects can 'talk' to
each other. What I found was the WSDL was never loaded.
So I moved the WSDL local to the PHP file and accessed it directly. Still no calls. Turns out,
PHP's SoapClient seems to have a problem with 'localhost' as a web service endpoint.
So I hand-edited the web service endpoint URL to read 127.0.0.1 instead of localhost, and Voila! Web
Service calls work:
Here is my PHP, now working:
<?php
$client = new SoapClient("http://localhost/code/soap.wsdl");
$something = $client->HelloWorld(array());
echo $something->HelloWorldResult;
die();
?>
Here is my modified WSDL:
<wsdl:service name="MyService">
<wsdl:port name="MyServiceSoap" binding="tns:MyServiceSoap">
<soap:address location="http://127.0.0.1:55274/MyService/MyService.asmx"
/>
....
</wsdl:port>
----
Server IP: 69.147.83.197
Probable Submitter: 71.232.36.236
----
Manual Page -- http://www.php.net/manual/en/class.soapclient.php
Edit -- https://master.php.net/note/edit/105226
Del: integrated -- https://master.php.net/note/delete/105226/integrated
Del: useless -- https://master.php.net/note/delete/105226/useless
Del: bad code -- https://master.php.net/note/delete/105226/bad+code
Del: spam -- https://master.php.net/note/delete/105226/spam
Del: non-english -- https://master.php.net/note/delete/105226/non-english
Del: in docs -- https://master.php.net/note/delete/105226/in+docs
Del: other reasons-- https://master.php.net/note/delete/105226
Reject -- https://master.php.net/note/reject/105226
Search -- https://master.php.net/manage/user-notes.php