in reply to Re: SOAP::Lite with client using service
in thread SOAP::Lite with client using service

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>

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

    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\

      Hmm thanks but it didn't seem to make much difference.

      The inderlying module still never gets called.

      The server code is in two parts.

      The service itself
      #! /usr/bin/perl use strict; use lib '/var/www/perl-bin'; use SOAP::Transport::HTTP; print STDERR ("service called\n"); SOAP::Transport::HTTP::CGI -> dispatch_to('testSoap') -> handle; exit(0);


      ...and the underlying module

      package testSoap; use DBI; sub get{ print STDERR "module called\n"; my ($self,$id) = @_; my $userinfo = { ID => 0, first => '', surname => '', age => 0, phone => '' }; if ($id != 0 ){ my $dbh = DBI->connect('DBI:mysql:CF:' . '127.0.0.1', '<username> +', '<password>'); my $sth = $dbh->prepare("select * from user where id=$id"); $sth->execute; my $stuff= $sth->fetchrow_hashref; if ($stuff){ $userinfo->{ID} = $stuff->{id}; $userinfo->{first} = $stuff->{firstname}; $userinfo->{surname} = $stuff->{surname}; $userinfo->{age} = $stuff->{age}; $userinfo->{phone} = $stuff->{phone}; } } return $userinfo; } 1;
      As you can see I get both to print to STDERR when they are called so I can see in the apache logs. but the module never gets called. Thanks again

        Okay I faked up a server that returns the same hash as yours and then manually re-did the WSDL - fixing the transport, SOAP version namespace and soapAction and this appears now to work:

        <?xml version="1.0" encoding="UTF-8"?> <definitions name="webService" targetNamespace="http://127.0.0.1/soapTest" 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/soapTest" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://127.0.0.1/webService.xsd1"> <types> <xsd:schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://127.0.0.1/webService.xsd1"> <xsd:complexType name="item"> <xsd:all> <xsd:element maxOccurs="1" minOccurs="1" name= +"key" type="xsd:anyType"/> <xsd:element maxOccurs="1" minOccurs="1" name= +"value" type="xsd:anyType"/> </xsd:all> </xsd:complexType> <xsd:complexType name="Map"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="item +" type="apachesoap:item"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </types> <message name="get_OUT"> <part name="id" type="xsd:int"/> </message> <message name="get_IN"> <part name="user" type="apachesoap:Map"/> </message> <portType name="webServicePortType"> <operation name="get"> <input message="tns:get_OUT"/> <output message="tns:get_IN"/> </operation> </portType> <binding name="webServiceBinding" type="tns:webServicePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.or +g/soap/http"/> <operation name="get"> <soap:operation soapAction="http://127.0.0.1/testSoap#get" +/> <input> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" namespace="http://127.0.0.1/testSoap" parts="id" use="encoded"/> </input> <output> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" namespace="http://127.0.0.1/testSoap" parts="user" use="encoded"/> </output> </operation> </binding> <service name="webService"> <port binding="tns:webServiceBinding" name="webServicePort"> <soap:address location="http://127.0.0.1/cgi-bin/webservic +e.cgi"/> </port> </service> </definitions>

        /J\