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

Error Retrieving Soap Fault

Expand Messages
  • Nate Bowler <nate_bowler@attbi.com>
    I m calling a test function that creates a SOAP Fault. The server is implemented in Java. However, when I call this method, $result is undefined, so my check
    Message 1 of 3 , Dec 18, 2002
    • 0 Attachment
      I'm calling a test function that creates a SOAP Fault. The server is
      implemented in Java. However, when I call this method, $result is
      undefined, so my check to $result->fault fails.

      Does anybody know what is going on here?

      I've attached my Perl code and the XML response below:

      #!perl -w
      #!d:\perl\bin\perl.exe
      use SOAP::Lite;

      my $attask_tns = 'http://www.attask.com/api';

      my $api_server = SOAP::Lite
      -> soapversion(1.2)
      -> uri('http://www.attask.com/api')
      -> service('http://localhost:8081/attask/APIService.wsdl');

      ##################################################
      # login
      my $sessionID = $api_server->login("admin","user");

      ##################################################
      # call createFault
      $result = $api_server->createFault(1);

      if( $result->fault ){
      print "In here!!\n";
      }

      ##################################################
      # logout
      $api_server->logout($sessionID);




      <!--SOAP Response-->
      <?xml version="1.0" encoding="UTF-8"?>
      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns0="http://www.attask.com/api"
      env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

      <env:Body>
      <env:Fault xsi:type="env:Fault">
      <faultcode>env:Server</faultcode>
      <faultstring>com.attask.api.AtTaskAPIException</faultstring>
      <detail>
      <ns0:AtTaskAPIException xsi:type="xsd:string">This is a test SOAP
      Fault!!</ns0:AtTaskAPIException>
      </detail>
      </env:Fault>
      </env:Body>

      </env:Envelope>
    • Duncan Cameron
      ... When using the service() approach, the result of your createFault() is not a SOM object, it really is the result of your call. So you can t call the
      Message 2 of 3 , Dec 18, 2002
      • 0 Attachment
        On 2002-12-18 Nate Bowler <nate_bowler wrote:
        >I'm calling a test function that creates a SOAP Fault. The server is
        >implemented in Java. However, when I call this method, $result is
        >undefined, so my check to $result->fault fails.
        >
        >Does anybody know what is going on here?
        >
        >I've attached my Perl code and the XML response below:
        >
        >#!perl -w
        >#!d:\perl\bin\perl.exe
        >use SOAP::Lite;
        >
        >my $attask_tns = 'http://www.attask.com/api';
        >
        >my $api_server = SOAP::Lite
        > -> soapversion(1.2)
        > -> uri('http://www.attask.com/api')
        > -> service('http://localhost:8081/attask/APIService.wsdl');
        >
        >##################################################
        ># login
        >my $sessionID = $api_server->login("admin","user");
        >
        >##################################################
        ># call createFault
        >$result = $api_server->createFault(1);
        >
        >if( $result->fault ){
        > print "In here!!\n";
        >}
        >
        >##################################################
        ># logout
        >$api_server->logout($sessionID);
        >
        >
        When using the service() approach, the result of your createFault()
        is not a SOM object, it really is the result of your call. So you
        can't call the fault() method on it, nor the result() method either.
        To get the flexibility you want you need to specify the proxy and
        uri directly.


        Regards,
        Duncan Cameron
      • Paul Kulchenko
        Hi Duncan, ... While that s correct you can still access this information using ... $r = $api_server- call(); # call() without parameters returns the result of
        Message 3 of 3 , Dec 18, 2002
        • 0 Attachment
          Hi Duncan,

          > When using the service() approach, the result of your createFault()
          > is not a SOM object, it really is the result of your call. So you
          While that's correct you can still access this information using
          call() method:

          > >$result = $api_server->createFault(1);

          $r = $api_server->call(); # call() without parameters returns the
          result of the last call

          die $r->faultstring if $r->fault;

          > >my $api_server = SOAP::Lite
          > > -> soapversion(1.2)
          soapversion() call shouldn't be made at run-time (this syntax will be
          disallowed in the future). The correct usage is this:

          use SOAP::Lite soapversion => 1.2;

          Best wishes, Paul.

          --- Duncan Cameron <dcameron@...> wrote:
          > On 2002-12-18 Nate Bowler <nate_bowler wrote:
          > >I'm calling a test function that creates a SOAP Fault. The server
          > is
          > >implemented in Java. However, when I call this method, $result is
          > >undefined, so my check to $result->fault fails.
          > >
          > >Does anybody know what is going on here?
          > >
          > >I've attached my Perl code and the XML response below:
          > >
          > >#!perl -w
          > >#!d:\perl\bin\perl.exe
          > >use SOAP::Lite;
          > >
          > >my $attask_tns = 'http://www.attask.com/api';
          > >
          > >my $api_server = SOAP::Lite
          > > -> soapversion(1.2)
          > > -> uri('http://www.attask.com/api')
          > > -> service('http://localhost:8081/attask/APIService.wsdl');
          > >
          > >##################################################
          > ># login
          > >my $sessionID = $api_server->login("admin","user");
          > >
          > >##################################################
          > ># call createFault
          > >$result = $api_server->createFault(1);
          > >
          > >if( $result->fault ){
          > > print "In here!!\n";
          > >}
          > >
          > >##################################################
          > ># logout
          > >$api_server->logout($sessionID);
          > >
          > >
          > When using the service() approach, the result of your createFault()
          >
          > is not a SOM object, it really is the result of your call. So you
          > can't call the fault() method on it, nor the result() method
          > either.
          > To get the flexibility you want you need to specify the proxy and
          > uri directly.
          >
          >
          > Regards,
          > Duncan Cameron
          >
          >
          >
          >
          >
          >
          > ------------------------ 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!?
          Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
          http://mailplus.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.