Home » Web Services » SOAP » Bug #1953
Unable to call a webservice from javascript
Details
| Submitted | 2004-07-22 14:24 UTC |
|---|---|
| From | kobler at help2 dot com |
| Assigned | chagenbu |
| Status | No Feedback |
| Package | SOAP |
| PHP Version | 5.0.0 |
| OS | WindowsXP |
| Roadmaps | (Not assigned) |
Comments
[2004-07-22 14:24 UTC] kobler at help2 dot com
Description:
------------
Hi,
I try to call a simple web service from IE using javascript soap webservice. This webservice works if I access it with a soapclient in php, but didn't work if I try from javascript.
In this sample I just try to access to a method called "test" that return a string value.
I've make some tests and apparently soapServer don't recognize the namespace ...
Here is the soap enveloppe if I call it from javascript :
<?xml version='1.0' encoding='utf-8'?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:HelloServer" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<mswsb:test xmlns:mswsb="HelloServer" xmlns=""></mswsb:test></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
As you can see there is some differences in the soap body compare to the same call doing from soapclient write in php :
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="HelloServer"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:test/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Reproduce code:
---------------
The javascript MS soap call :
<?xml version='1.0' encoding='utf-8'?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:HelloServer" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<mswsb:test xmlns:mswsb="HelloServer" xmlns=""></mswsb:test></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Expected result:
----------------
I receive this error message :
"method '}test' not defined in service"
When I try to call the "test" method (that just return a string value)