Skip Menu |

This queue is for tickets about the SOAP-Lite CPAN distribution.

Report information
The Basics
Id: 29505
Status: open
Priority: 0/
Queue: SOAP-Lite

People
Owner: Nobody in particular
Requestors: roman.daniel [...] gtsnovera.cz
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.69
Fixed in: (no value)



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
Download stockquote.wsdl
application/octet-stream 4.7k

Message body not shown because it is not plain text.

Subject: stockquote_mod.wsdl
Download stockquote_mod.wsdl
application/octet-stream 4.7k

Message body not shown because it is not plain text.

RT-Send-CC: soaplite-devel [...] lists.sourceforge.net
This is due to the way namespaces are handled in SOAP::Lite - prefixes and namespaces are placed into a hash with namespaces as keys and prefixes as values. When the envelope is created, the hash is reversed, thus namespaces registered with conflicting prefixes wipe out each other. The required fix is to reverse namespace handling - namespaces must be registered with their associated prefixes as keys, and the namespace names as values. This is required for associating multiple prefixes with the same namespace, too. Martin
Hi, The easiest workaround is to add the following line to your code (somewhere at start): $SOAP::Constants::PREFIX_ENV = 'SOAP-ENV'; This makes SOAP::Lite use SOAP-ENV as envelope prefix and avoids the namespace clash. Martin