Subject: | Namespace having prefix soap in WSDL file used in soap envelope |
I have a WSDL file (stockquote.wsdl downloaded from
http://www.webservicex.net/stockquote.asmx?WSDL)
with namespace declaration
<tt>xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"</tt>.
I create SOAP client using <tt>SOAP::Lite->service($wsdl)</tt> to create
SOAP client object and call a method from the WSDL file.
<pre>
use strict;
use SOAP::Lite qw(trace all);
my $s = SOAP::Lite->service('file:stockquote.wsdl');
warn $s->GetQuote('MSFT');
</pre>
Unfortunately the soap namespace from the WSDL is used as the namespace
of Envelope element in SOAP message
<pre>
...
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://www.webserviceX.NET/"><soap:Body><tns:GetQuote><symbol
xsi:type="s:string">MSFT</symbol></tns:GetQuote></soap:Body></soap:Envelope>
</pre>
which is not understood by the server
<pre>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:VersionMismatch</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Possible
SOAP version mismatch: Envelope namespace
http://schemas.xmlsoap.org/wsdl/soap/ was unexpected. Expecting
http://schemas.xmlsoap.org/soap/envelope/.
at System.Web.Services.Protocols.SoapServerProtocol.CheckHelperVersion()
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
at
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
</pre>
Trying a service powered by SOAP::Lite 0.69 server the result is similar:
<pre>
SOAP fault: SOAP-ENV:VersionMismatch Wrong SOAP version specified.
Supported versions:
1.1 (http://schemas.xmlsoap.org/soap/envelope/)
1.2 (http://www.w3.org/2001/06/soap-envelope)
</pre>
If I use different prefix for the
<tt>http://schemas.xmlsoap.org/wsdl/soap/</tt> namespace (see
stockquote_mod.wsdl)</tt> the envelope is different and the call is
understood:
<pre>
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://www.webserviceX.NET/"><soap:Body><tns:GetQuote><symbol
xsi:type="s:string">MSFT</symbol></tns:GetQuote></soap:Body></soap:Envelope>
</pre>
IMHO the bug is not unimportant since most of the WSDLs I've seen so far
have the soap prefix attached to
<tt>http://schemas.xmlsoap.org/wsdl/soap/</tt>
and thus the services cannot be easily called via SOAP::Lite->service.
Subject: | stockquote.wsdl |
Message body not shown because it is not plain text.
Subject: | stockquote_mod.wsdl |
Message body not shown because it is not plain text.