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

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

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

      --- Alexei Barantsev <barancev@...> wrote:
      > 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!
      Sorry, I wasn't clear. You can access SOM object using call() method
      without parameters, like this:

      my $service = SOAP::Lite->service(...);
      my $result = $service->method();
      die $service->call->faulstring if $service->call->fault;

      > I'd suggest to add fault checking to stubs generated:
      It's possible, but in this case the same call will return result (in
      some cases) and SOAP::SOM object (in some other cases), so your code
      to handle it becomes something like this:

      my $service = SOAP::Lite->service(...);
      my $result = $service->method();
      die $result->faultstring
      if UNIVERSAL::isa($result, 'SOAP::SOM') && $result->fault;

      which is not very nice. Am I missing something? Thanks for the advice
      anyway ;)

      I posted about 50 slides from P2P conference and one of them covers
      error handling with WSDL. Take a look here:
      http://conf.soaplite.com/p2p/45.html

      Best wishes, Paul.

      >
      > 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) = @_;
      >
      === message truncated ===


      __________________________________________________
      Do You Yahoo!?
      Find the one for you at Yahoo! Personals
      http://personals.yahoo.com
    • Show all 8 messages in this topic