Loading ...
Sorry, an error occurred while loading the content.

996RE: [soaplite] SOAP::Lite & WSDL - some questions (long)

Expand Messages
  • Alexei Barantsev
    Nov 13, 2001
    • 0 Attachment
      Hi, Paul!

      Back to the question. I have the same problem and solution suggested does
      not work for me.

      I mean return value of SOAP::Lite->service( ... )->method() - it is really,
      really empty if something wrong occured.
      And you cannot check it with
      if ($result->fault) {...}
      because it is not SOM, it is emply!

      The problem lies in stub generated for the method:
      ----------------
      my $som = $self
      -> endpoint($method{endpoint})
      -> uri($method{uri})
      -> on_action(sub{qq!"$method{soapaction}"!})
      -> call($method => map {shift(@templates)->value($_)} @_);
      UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall :
      $som->result : $som;
      ----------------
      So I have usually got either $som->paramsall or $som->result.

      Let's suppose a server dies with SOAP::Fault. In this case it returns 500
      code and SOAP::Fault in the body of the response message.
      Deserialiser creates SOM that contains fault information. But I get back
      $som->paramsall or $som->result instead that are empty both.
      The only chance to access SOM is on_fault handler but I can't register my
      own handler without changing generated stubs.

      I'd suggest to add fault checking to stubs generated:
      ----------------
      my $som = $self
      -> endpoint($method{endpoint})
      -> uri($method{uri})
      -> on_action(sub{qq!"$method{soapaction}"!})
      -> call($method => map {shift(@templates)->value($_)} @_);
      UNIVERSAL::isa($som => 'SOAP::SOM') ? $som->fault ? $som : wantarray ?
      $som->paramsall : $som->result : $som;
      ----------------
      After that solusion suggested by Paul grows to work.

      Best regards,
      Alexei

      --
      Alexei Barantsev, ISP RAS
      E-mail: barancev@...
      ICQ : 3959207

      > -----Original Message-----
      > From: Paul Kulchenko [mailto:paulclinger@...]
      > Sent: Monday, September 10, 2001 6:41 PM
      > To: soaplite@yahoogroups.com; SOAP
      > Cc: pow@...
      > Subject: Re: [soaplite] SOAP::Lite & WSDL - some questions (long)
      >
      >
      > Hi, Jean-Jack!
      [...]
      > > # with the use of ->service the result is always empty :(
      > > if ($result) {
      > > print $result->result();
      > > } else
      > > print "EMPTY!!!!\n\n";
      > > }
      > You can always get better diagnostics using $result->faultstring:
      >
      > if ($result->fault) { # check for fault
      > print $result->faultstring;
      > } else {
      > print $result->result;
      > }
      >
      > Hope it helps. Let me know if you still have problem.
      >
      > Best wishes, Paul.
      >
      > --- "Jean-Jack M. Riethoven" <pow@...> wrote:
      > >
      > > Greetings,
      > >
      > > I am trying to set up a SOAP service using the Perl SOAP::Lite
      > > modules, and
      > > I was up and running in less than 10 minutes (Kudos to the
      > > developer of
      > > SOAP::Lite!)
      > >
      > > Everything works fine from my little SOAP client, accessing the
      > > server
      > > directly. I am now trying to set up access via WSDL, and I am
      > > hopelessly
      > > lost :)
      > >
      > > I even slimmed down the server so that basically I give it a string
      > > and it
      > > should return the same string back. I hope you don't mind dumping
      > > you with
      > > source code and WSDL, but maybe a thousand people can see what I
      > > cannot.
      > >
      > > When I execute the client with the ->service() call I can see the
      > > .wsdl
      > > file being downloaded, the SOAP-server.pl being run (with a 500
      > > error)...
      > > and an undefined result (obviously) returned. Running the client
      > > via ->uri
      > > and ->proxy works like a charm.
      > >
      > > My thought is the problem must be in WSDL, or in SOAP::Lite's WSDL
      > > handling, since a normal SOAP call directly to the server works..
      > > So I'll
      > > list the WSDL first:
      > >
      > >
      > >
      > > <?xml version = "1.0"?>
      > > <definitions name="XEMBL"
      > > targetNamespace="http://www.ebi.ac.uk/xembl/XEMBL.wsdl"
      > > xmlns:tns="http://www.ebi.ac.uk/xembl/XEMBL.wsdl"
      > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      > > xmlns="http://schemas.xmlsoap.org/wsdl/">
      > > <message name="FullSequenceRequest">
      > > <part name="id" type="xsd:string" />
      > > </message>
      > > <message name="FullSequenceResponse">
      > > <part name="result" type="xsd:string" />
      > > </message>
      > > <portType name="XEMBLPortType">
      > > <operation name="FullSequence">
      > > <input message="tns:FullSequenceRequest"
      > > name="FullSequence"/>
      > > <output message="tns:FullSequenceResponse"
      > > name="FullSequenceResponse" />
      > > </operation>
      > > </portType>
      > > <binding name="XEMBLServiceBinding" type="tns:XEMBLPortType">
      > > <soap:binding style="rpc"
      > > transport="http://schemas.xmlsoap.org/soap/http" />
      > > <operation name="FullSequence">
      > > <soap:operation soapAction="" />
      > > <input>
      > > <soap:body use="encoded"
      > > namespace="http://www.ebi.ac.uk/xembl/XEMBL.wsdl"
      > >
      > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      > > </input>
      > > <output>
      > > <soap:body use="encoded"
      > > namespace="http://www.ebi.ac.uk/xembl/XEMBL.wsdl"
      > >
      > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      > > </output>
      > > </operation>
      > > </binding>
      > > <service name="XEMBLService">
      > > <documentation>Returns full information on EMBL Nucleotide
      > > Sequences
      > > formatted as Bsml XML or Agave XML</documentation>
      > > <port name="XEMBLPort" binding="tns:XEMBLServiceBinding">
      > > <soap:address
      > > location="http://www.ebi.ac.uk:80/cgi-bin/xembl/SOAP-server.pl" />
      > > </port>
      > > </service>
      > > </definitions>
      > >
      > >
      > > Basically, the server SOAP-server.pl is this:
      > >
      > > #!/sw/arch/bin/perl -w
      > >
      > > use SOAP::Transport::HTTP;
      > >
      > > SOAP::Transport::HTTP::CGI
      > > -> dispatch_to('XEMBL')
      > > -> handle;
      > >
      > >
      > > package XEMBL;
      > >
      > > sub FullSequence
      > >
      > > my ($class, $acc_nr) = @_;
      > > my ($result);
      > >
      > > use LWP::Simple; # Use the LWP::Simple package.
      > >
      > > $result = $acc_nr;
      > >
      > > return $result;
      > > }
      > >
      > >
      > > 1;
      > >
      > > The client is as follows:
      > >
      > > #!/sw/arch/bin/perl
      > >
      > > # Simple program that connects to the SOAP server to retrieve
      > > # sequence information in either Bsml or AGAVE XML format.
      > >
      > > use SOAP::Lite; # SOAP API
      > >
      > > # THIS WORKS!
      > > # my $soap = SOAP::Lite
      > > # -> uri('http://www.ebi.ac.uk/XEMBL')
      > > # -> proxy('http://www.ebi.ac.uk/cgi-bin/xembl/SOAP-server.pl');
      > >
      > > my $soap = SOAP::Lite
      > > -> service('http://www.ebi.ac.uk/xembl/XEMBL.wsdl');
      > >
      > >
      > > $result = $soap->FullSequence('HSERPG');
      > >
      > >
      > > # with the use of ->service the result is always empty :(
      > > if ($result) {
      > > print $result->result();
      > > } else
      > >
      > > print "EMPTY!!!!\n\n";
      > > }
      > >
      > >
      > > Thank you very much for your time!
      > >
      > > With kind regards,
      > >
      > > --
      > > drs. Jean-Jack M. Riethoven
      > >
      > > EMBL Outstation - Hinxton pow@... ICQ#: 3433929
      > > European Bioinformatics Institute Phone: (+44) 1223 494635
      > > Wellcome Trust Genome Campus Fax : (+44) 1223 494468
      > > Hinxton, Cambridge CB10 1SD URL :
      > > http://industry.ebi.ac.uk/
      > > UNITED KINGDOM
      > >
      > > Need to find bioinformatics or molecular biology web sites or
      > > resources?
      > > Use BioWurld at http://www.ebi.ac.uk/biowurld
      > >
      > >
      > > ------------------------ Yahoo! Groups Sponsor
      > >
      > > To unsubscribe from this group, send an email to:
      > > soaplite-unsubscribe@yahoogroups.com
      > >
      > >
      > >
      > > Your use of Yahoo! Groups is subject to
      > > http://docs.yahoo.com/info/terms/
      > >
      > >
      >
      >
      > __________________________________________________
      > Do You Yahoo!?
      > Get email alerts & NEW webcam video instant messaging with Yahoo!
      > Messenger
      > http://im.yahoo.com
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    • Show all 8 messages in this topic