Reputation: 5302
I'm trying to call web service function direct from the URL.
The web service is reached via:
~mysite~/server.php?wsdl
This brings up a list of all the web services. The one I'm trying to access is:
<operation name="fetchSplash">
<documentation>Fetch Home Page</documentation>
<input message="tns:fetchSplashIn"/>
<output message="tns:fetchSplashOut"/>
</operation>
It takes two parameters:
function fetchSplash($sessionCode,$brand=null)
So I thought I might be able to call it by doing something like:
/server.php?wsdl/fetchSplash&sessionCode=A6C298B9-359143D6-A591-8D7016F0B72E&brand=1
But this returns:
<SOAP-ENV:Fault>
<faultcode>Sender</faultcode>
<faultstring>Invalid XML</faultstring>
</SOAP-ENV:Fault>
Can anyone tell me if it's possible to call the function directly from the URL?
Upvotes: 1
Views: 1814
Reputation: 2073
By using a plain url from the address bar, no, that is not possible (unless of course someone would implement this on top of the soap protocol).
The way soap works is by doing a http POST request with some xml as the payload. Like this (the xml is untested and probably not 100% correct):
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:fetchSplash>
<m:sessionCode>A6C298B9-359143D6-A591-8D7016F0B72E</m:sessionCode>
<m:brand>1</m:brand>
</m:fetchSplash>
</soap:Body>
</soap:Envelope>
You should be able to sent this request to your server using a application that can make custom http requests ("Advanced Rest Client" for chrome is an example).
Upvotes: 3