in reply to SOAP::Lite with client using service

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\

  • Comment on Re: SOAP::Lite with client using service

Replies are listed 'Best First'.
Re^2: SOAP::Lite with client using service
by jammin (Novice) on Apr 26, 2005 at 13:27 UTC
    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\

        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