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

SOAP::Lite & WSDL - some questions (long)

Expand Messages
  • Jean-Jack M. Riethoven
    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
    Message 1 of 8 , Sep 10 4:46 AM
    • 0 Attachment
      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
    • Paul Kulchenko
      Hi, Jean-Jack! ... Yes, there are some differences between parameters you specified in direct call and parameters in WSDL. First of all, namespace is
      Message 2 of 8 , Sep 10 7:40 AM
      • 0 Attachment
        Hi, Jean-Jack!

        > 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..
        Yes, there are some differences between parameters you specified in
        direct call and parameters in WSDL.

        First of all, namespace is different. WDSL should have:
        namespace="http://www.ebi.ac.uk/XEMBL"

        Second, soapAction is different. SOAP::Lite uses URI#method as a
        SOAPAction by default, so you need to specify it in WSDL file, or
        change it on server side using on_action handler. Let's do it in
        WSDL:
        soapAction="http://www.ebi.ac.uk/XEMBL#FullSequence" />

        Now <operation> section looks like:

        <operation name="FullSequence">
        <soap:operation
        soapAction="http://www.ebi.ac.uk/XEMBL#FullSequence" />
        <input>
        <soap:body use="encoded"
        namespace="http://www.ebi.ac.uk/XEMBL"

        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
        </input>
        <output>
        <soap:body use="encoded"
        namespace="http://www.ebi.ac.uk/XEMBL"

        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
        </output>
        </operation>

        > # 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
      • Alexei Barantsev
        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( ...
        Message 3 of 8 , 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/
          >
          >
        • Paul Kulchenko
          Hi, Alexei! ... Sorry, I wasn t clear. You can access SOM object using call() method without parameters, like this: my $service = SOAP::Lite- service(...); my
          Message 4 of 8 , 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
          • Alexei Barantsev
            Hi, Paul! I agree, my suggestion was not good enough. I have another one :) What I expect from web-service? To be transparent, to behave like usual
            Message 5 of 8 , Nov 14, 2001
            • 0 Attachment
              Hi, Paul!

              I agree, my suggestion was not good enough. I have another one :)

              What I expect from web-service? To be transparent, to behave like usual
              class/object.
              The result of a call should be what server want to return, you are right.
              But then we should go further - what if server raises exception?
              In this case I want to get an exception on client side.
              Especially if the server dies with SOAP::Fault I want to be able to catch
              SOAP::Fault object.
              Why shoul I pollute my code with if ($servise->call->fault) checking? I want
              to catch exceptions instead.

              So, my suggestion is to add fault checking to the stub generated. Version 2.
              ----------------
              my $som = $self
              -> endpoint($method{endpoint})
              -> uri($method{uri})
              -> on_action(sub{qq!"$method{soapaction}"!})
              -> call($method => map {shift(@templates)->value($_)} @_);
              if (UNIVERSAL::isa($som, 'SOAP::SOM') && $som->fault) {
              die SOAP::Fault->faultcode($som->faultcode || '')
              ->faultstring($som->faultstring || '')
              ->faultdetail($som->faultdetail || '')
              ->faultactor($som->faultactor || '');
              }
              UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall :
              $som->result : $som;
              ----------------

              And client now slould do call this way:
              ----------------
              my $result = eval { $service->method };
              @$ && do { warn UNIVERSAL::isa( $@, 'SOAP::Fault' ? $@->faultcode.' :
              '.$@->faultstring : $@ ) };
              ----------------

              Besr regards,
              Alexei

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


              > -----Original Message-----
              > From: Paul Kulchenko [mailto:paulclinger@...]
              > Sent: Tuesday, November 13, 2001 8:57 PM
              > To: barancev@...; soaplite@yahoogroups.com
              > Subject: RE: [soaplite] SOAP::Lite & WSDL - some questions (long)
              >
              >
              > 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
            • Mental
              ... ... Forgive the question, but can you set a timeout for something you re accessing via - service similarly? Detecting a fault is great! No results
              Message 6 of 8 , Dec 4, 2001
              • 0 Attachment
                On Tue, Nov 13, 2001 at 09:57:28AM -0800, Paul Kulchenko wrote:
                > Hi, Alexei!
                >
                <SNIP>
                > 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;
                >

                Forgive the question, but can you set a timeout for something you're
                accessing via ->service similarly? Detecting a fault is great! No results
                is different from an error, and its nice to catch them. However I'd also
                like to be able to specify a timeout. I'm looking but dont see how to d
                this unless you're using the ->proxy method. I'm looking at the code for
                SOAP::Lite::Transport::HTTP::Client and not seeing what I should be
                seeing...

                If SOAP::Transport::HTTP::Client ISA LWP::UserAgent then I should be able
                to set a timeout for the session.... right?



                --
                Mental (Mental@...)


                GPG public key: http://www.neverlight.com/Mental.asc
              • Paul Kulchenko
                Hi, Mental! ... Sure your can ;). Take a look here for more information: http://groups.yahoo.com/group/soaplite/message/830 For you code may look like: $s =
                Message 7 of 8 , Dec 4, 2001
                • 0 Attachment
                  Hi, Mental!

                  --- Mental <Mental@...> wrote:
                  > Forgive the question, but can you set a timeout for something
                  > you're accessing via ->service similarly?
                  Sure your can ;). Take a look here for more information:
                  http://groups.yahoo.com/group/soaplite/message/830

                  For you code may look like:

                  $s = SOAP::Lite->service('http://somewhere/something.wsdl');
                  $s->proxy('http://fake/', timeout => 3);

                  only protocol part is important for fake proxy. In a similar fashion
                  you can specify all other transport parameters, like proxy, cookie
                  and the rest.

                  > If SOAP::Transport::HTTP::Client ISA LWP::UserAgent then I should
                  > be able to set a timeout for the session.... right?
                  yes, as well as all other transport options.

                  Best wishes, Paul.

                  __________________________________________________
                  Do You Yahoo!?
                  Buy the perfect holiday gifts at Yahoo! Shopping.
                  http://shopping.yahoo.com
                • Mental
                  ... Hey, thanks! I was reading through the code and was thinking.... why not add a new entry to SOAP::Constants. Something like $CONNECT_TIMEOUT with a
                  Message 8 of 8 , Dec 4, 2001
                  • 0 Attachment
                    On Tue, Dec 04, 2001 at 01:16:31PM -0800, Paul Kulchenko wrote:
                    > Hi, Mental!
                    >
                    > --- Mental <Mental@...> wrote:
                    > > Forgive the question, but can you set a timeout for something
                    > > you're accessing via ->service similarly?
                    > Sure your can ;). Take a look here for more information:
                    > http://groups.yahoo.com/group/soaplite/message/830
                    >
                    > For you code may look like:
                    >
                    > $s = SOAP::Lite->service('http://somewhere/something.wsdl');
                    > $s->proxy('http://fake/', timeout => 3);
                    >
                    > only protocol part is important for fake proxy. In a similar fashion
                    > you can specify all other transport parameters, like proxy, cookie
                    > and the rest.
                    >
                    > > If SOAP::Transport::HTTP::Client ISA LWP::UserAgent then I should
                    > > be able to set a timeout for the session.... right?
                    > yes, as well as all other transport options.
                    >
                    > Best wishes, Paul.

                    Hey, thanks! I was reading through the code and was thinking....

                    why not add a new entry to SOAP::Constants. Something like
                    $CONNECT_TIMEOUT with a reasonable value. Then in each transport set its
                    timeout to that value when you instantiate a new client. It'd be easy to
                    do, inside HTTP.pm in sub patch, just set LWP::Useragent's time out to
                    $SOAP::Constants::CONNECT_TIMEOUT.

                    You way certainly works, its just less hacky looking if there were a
                    proper get/set for it. Know what I mean? No need for a fake proxy.

                    Or would this be abusing the purpose of SOAP::Constants? I'm still not
                    overly familiar with the code base.

                    I havent looked at the other protocols yet, so it may not be applicable to
                    say... udp protocols. But still. It could be a cool thing to have handy.


                    Anyways, just thinking about it...

                    Thanks again!

                    --
                    Mental (Mental@...)


                    GPG public key: http://www.neverlight.com/Mental.asc
                  Your message has been successfully submitted and would be delivered to recipients shortly.