jammin has asked for the wisdom of the Perl Monks concerning the following question:

Below is the server and two different implementations of a client. I have dumped the xml that the server receives from the two clients and it is now identical but while the b) works a) does not.

The call from a) never reaches the testSoap module where as b) does. Is there some obvious logic I am missing about using service rather than proxy?


The simple server:

SOAP::Transport::HTTP::CGI
-> dispatch_to('testSoap')
-> handle;


a) The simple client using 'service'

my $service = SOAP::Lite
-> service('http://127.0.0.1/webservice.wsdl')
-> get($id);


b) The simple client using 'proxy'

my $stuff = SOAP::Lite
-> uri('http://127.0.0.1/testSoap')
-> proxy('http://127.0.0.1/perl-bin/webservice.cgi')
-> get($id)
-> result;

Replies are listed 'Best First'.
Re: SOAP::Lite with client using service
by gellyfish (Monsignor) on Apr 26, 2005 at 13:15 UTC

    I would hazard a guess that there is something wrong in your WSDL, can you post it here so we can take a look?

    /J\

      Thanks,

      <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="webservice" targetNamespace="http://127.0.0.1/testSoap" xmlns:tns="http://127.0.0.1/testSoap" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://schemas.xmlsoap.org/soap/encoding/" xmlns:apachesoap="http://xml.apache.org/xml-soap"> <wsdl:message name="get_IN"> <wsdl:part name="id" type="xsd:int" /> </wsdl:message> <wsdl:message name="get_OUT"> <wsdl:part name="user" type="apachesoap:Map" /> </wsdl:message> <wsdl:portType name="webserviceInt"> <wsdl:operation name="get"> <wsdl:input message="tns:get_IN" /> <wsdl:output message="tns:get_OUT" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="webserviceBinding" type="tns:webserviceInt"> <soap:binding style = "rpc" transport="http://schemas.xml.soap.org/soap/http"/> <wsdl:operation name="get"> <soap:operation soapAction="http://127.0.0.1/testSoap" /> <wsdl:input> <soap:body use="encoded" namespace="http://127.0.0.1/testSoap" encodingstyle="http://schemas.xmlsoap.org/soap/encodin +g/" /> </wsdl:input> <wsdl:output> <soap:body use="encoded" namespace="http://127.0.0.1/testSoap" encodingstyle="http://schemas.xmlsoap.org/soap/encodin +g/" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="webserviceService"> <wsdl:port name="webservicePort" binding="tns:webserviceBinding"> <soap:address location="http://127.0.0.1/perl-bin/webservice.cgi" /> </wsdl:port> </wsdl:service> </wsdl:definitions>

        This slightly fixed version appears to generate a working proxy, part of the problem appears to lie in the apachesoap:Map which apparently isn't support - you can work around this by adding the type yourself.

        <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="webservice" targetNamespace="http://127.0.0.1/testSoap" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://127.0.0.1/testSoap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://schemas.xmlsoap.org/soap/encoding/"> <types> <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"> </import> <complexType name="Map"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="item"> <complexType> <all> <element name="key" type="xsd:anyType"> </element> <element name="value" type="xsd:anyType"> </element> </all> </complexType> </element> </sequence> </complexType> <element name="Map" nillable="true" type="apachesoap:Map"> </element> </schema> </types> <wsdl:message name="get_OUT" namespace="http://127.0.0.1/testSoap"> <wsdl:part name="user" type="apachesoap:Map"> </wsdl:part> </wsdl:message> <wsdl:message name="get_IN" namespace="http://127.0.0.1/testSoap"> <wsdl:part name="id" type="xsd:int"> </wsdl:part> </wsdl:message> <wsdl:portType name="webserviceInt"> <wsdl:operation name="get"> <wsdl:input message="tns:get_IN"> </wsdl:input> <wsdl:output message="tns:get_OUT"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="webserviceBinding" type="tns:webserviceInt"> <soap:binding style="rpc" transport="http"> </soap:binding> <wsdl:operation name="get"> <soap:operation soapAction="http://127.0.0.1/testSoap"> </soap:operation> <wsdl:input> <soap:body namespace="http://127.0.0.1/testSoap" parts="tns:get_IN" use="encoded"> </soap:body> </wsdl:input> <wsdl:output> <soap:body namespace="http://127.0.0.1/testSoap" parts="tns:get_OUT" use="encoded"> </soap:body> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="webserviceService"> <wsdl:port binding="tns:webserviceBinding" name="webservicePort"> <soap:address location="http://127.0.0.1/perl-bin/webservice.cgi"> </soap:address> </wsdl:port> </wsdl:service> </wsdl:definitions>
        Obviously it is a bit tricky to test as I don't have access to your server code.

        /J\