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

how to trace a error those generated at runtime by server in soap::Lite

Expand Messages
  • Rushikesh Joshi
    I have really no any idea how can i trace the error that are generated at runtime. Like invalide arguments, error in type conversion, user already registered,
    Message 1 of 8 , Aug 19, 2004

      I have really no any idea how can i trace the error that are generated at runtime.
      Like invalide arguments, error in type conversion, user already registered, user deactive..
       
      This fault strings are generated by server but i m unable to trake it using SOAP::Lite
       
      I have tried to...
      use SOAP::Lite +trace => 'debug';
      But it is no any help full i required to realtime error traping
       
      So any one have idea how to trace all the error that generated at runtime .......

      Is there any methods to retrive last Request & Resoponse & faults ............
       
      Your help will be greatly appreciate for me.
       
      Thanks & Regards,
      Rushikesh
      Sr. Software Developer,
      Mega-E-Services


      Do you Yahoo!?
      New and Improved Yahoo! Mail - 100MB free storage!
    • Duncan Cameron
      ... See the SOAP::SOM section of the documentation. It gives access to the complete SOAP message. Regards Duncan
      Message 2 of 8 , Aug 19, 2004
        At 2004-08-19, 14:30:24 Rushikesh Joshi <rushi_asi@...> wrote:

        >I have really no any idea how can i trace the error that are generated
        >at runtime.
        >Like invalide arguments, error in type conversion, user already
        >registered, user deactive..
        >
        >This fault strings are generated by server but i m unable to trake it
        >using SOAP::Lite
        >
        >I have tried to...
        >use SOAP::Lite +trace => 'debug';
        >But it is no any help full i required to realtime error traping
        >
        >So any one have idea how to trace all the error that generated at
        >runtime .......
        >
        >Is there any methods to retrive last Request & Resoponse & faults

        See the SOAP::SOM section of the documentation. It gives access to the
        complete SOAP message.

        Regards
        Duncan
      • Mark Fuller
        ... Are you saying trace/trap errors the server has with the client s parms (or other processing using those parms), and trace/trap them on the server? Or,
        Message 3 of 8 , Aug 19, 2004
          --- Rushikesh Joshi <rushi_asi@...> wrote:
          > I have really no any idea how can i trace the error
          > that are generated at runtime.

          Are you saying trace/trap errors the server has with
          the client's parms (or other processing using those
          parms), and trace/trap them on the server? Or,
          trap/trace errors the server returns to the client,
          and trap/trace them on the client?

          In the first case, everywhere you would generate a
          soapfault message in your server you'd have to write
          custom log messages to a file.

          In the second case, the server would do something like
          this:

          -------
          die SOAP::Fault->faultcode('Server.Custom') # will be
          qualified
          ->faultstring('Died in server method')
          ->faultdetail(bless {code => 1} => 'BadError')
          ->faultactor('http://www.soaplite.com/custom');

          And the client
          if ($result->fault) {
          print 'faultcode: ' . $result->faultcode . "\n";
          print 'faultstring: ' . $result->faultstring . "\n";
          print 'faultdetail: ' . $result->faultdetail . "\n";
          # returns the value of faultdetail'
          #
          element as string or object
          print '... access into nested hash (key \'code\'
          within key \'BadError\'): '
          .
          ${${$result->faultdetail}{BadError}}{code} . "\n";

          print 'faultactor: ' . $result->faultactor . "\n";
          #
          }

          ---------------

          Does that help?




          _______________________________
          Do you Yahoo!?
          Win 1 of 4,000 free domain names from Yahoo! Enter now.
          http://promotions.yahoo.com/goldrush
        • Rushikesh Joshi
          Thanks for your reply........... See below is my code to call my webservices method ######################### Code Starts ##################################
          Message 4 of 8 , Aug 19, 2004

            Thanks for your reply...........
            See below is  my code to call my webservices method

            ######################### Code Starts ##################################
            use Data::Dumper;
            use SOAP::Lite +trace => 'debug';
            my $_debug_=1; #to check code in debug mode
            my $service=SOAP::Lite->service("/root/testing/test.WSDL"); #create soap lite object

            $intTest=intTest(1,2,3); #call intTest method and save return value in some value
            prinrt $intTest; #print returned value of intTest method

            sub intTest{
             my (@param)=@_;
             if ($_debug_) {
              print "\n/-------------------- In intTest Method --------------------\\ \n";
             }
             #Call intTest method of webservices and stores data in $intTest variable
             my $intTest = $service->intTest(@param) or die ("Some Error at time of returning value");
             if ($_debug_) {
              print "\n Return Value in intTest Method:...............\n";
              pritn "$intTest","\n";
              print "\n\\-------------------- In End intTest Method --------------------/ \n";
             }
             return $intTest;
            }
            ########################### end of code ##################################

            intTest metod on my webserver is return some of passed parameter.
            So when I am executing this function I am receiving total (6).

            But problem is there whenever i am sending (1,"A",3) then the webserver method not executed and I am receiving
            "Some Error at time of Returing value at line ....".

            And below is my xml dump.
            <?xml version="1.0" encoding="UTF-8"?>
            <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmln
            s:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSc
            hema-instance">
             <soapenv:Body>
              <soapenv:Fault>
               <faultcode>soapenv:Server.userException</faultcode>
               <faultstring>org.xml.sax.SAXException: invalid datatype (integer, string, integer)</faultstring>
               <detail/>
              </soapenv:Fault>
             </soapenv:Body>
            </soapenv:Envelope>

            But this dump is taken from middle of sockets.
            And I want real error handling at die statement at time of returning the webmethod.
            I also tried below code but it hopeless

            my $intTest = $service->intTest(@param) or die ("Some Error at time of returning value Error:-".$intTest->faultstring);

            so what to do .........


            Your help will be greatly appreciate for me.
             
            Thanks & Regards,
            Rushikesh
            Sr. Software Developer,
            Mega-E-Services

            __________________________________________________
            Do You Yahoo!?
            Tired of spam? Yahoo! Mail has the best spam protection around
            http://mail.yahoo.com

          • Duncan Cameron
            ... When you use WSDL the result of the call is the return value from the service. To access the SOAP message you need to get the som object by using call()
            Message 5 of 8 , Aug 20, 2004
              At 2004-08-20, 07:24:36 Rushikesh Joshi <rushi_asi@...> wrote:

              >Thanks for your reply...........
              >See below is my code to call my webservices method
              >
              >######################### Code Starts
              >##################################
              >use Data::Dumper;
              >use SOAP::Lite +trace => 'debug';
              >my $_debug_=1; #to check code in debug mode
              >my $service=SOAP::Lite->service("/root/testing/test.WSDL"); #create
              >soap lite object
              >
              >$intTest=intTest(1,2,3); #call intTest method and save return value in
              >some value
              >prinrt $intTest; #print returned value of intTest method
              >
              >sub intTest{
              > my (@param)=@_;
              > if ($_debug_) {
              > print "\n/-------------------- In intTest Method --------------------
              >\\ \n";
              > }
              > #Call intTest method of webservices and stores data in $intTest
              >variable
              > my $intTest = $service->intTest(@param) or die ("Some Error at time
              >of returning value");
              > if ($_debug_) {
              > print "\n Return Value in intTest Method:...............\n";
              > pritn "$intTest","\n";
              > print "\n\\-------------------- In End intTest Method ---------------
              >-----/ \n";
              > }
              > return $intTest;
              >}
              >########################### end of code
              >##################################
              >
              >intTest metod on my webserver is return some of passed parameter.
              >So when I am executing this function I am receiving total (6).
              >
              >But problem is there whenever i am sending (1,"A",3) then the
              >webserver method not executed and I am receiving
              >"Some Error at time of Returing value at line ....".
              >
              >And below is my xml dump.
              ><?xml version="1.0" encoding="UTF-8"?>
              ><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap
              >org/soap/envelope/" xmln
              >s:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3
              >org/2001/XMLSc
              >hema-instance">
              > <soapenv:Body>
              > <soapenv:Fault>
              > <faultcode>soapenv:Server.userException</faultcode>
              > <faultstring>org.xml.sax.SAXException: invalid datatype (integer,
              >string, integer)</faultstring>
              > <detail/>
              > </soapenv:Fault>
              > </soapenv:Body>
              ></soapenv:Envelope>
              >
              >so what to do .........
              >
              When you use WSDL the result of the call is the return value from the
              service. To access the SOAP message you need to get the som object by
              using call() with no parameters.

              Something like this may work in your case. It is not clear whether an
              exception (die'ing) is occuring. In that case you need to wrap this in
              an eval{} block.

              my $result = $service->intTest(1, 'A', 3);
              my $som = $service->call();
              if ($som->fault) {
              # it failed
              print $som->faultdetail;
              print $som->faultcode;
              print $som->faultstring;
              } else {
              # it worked
              print $result;
              }
              Regards
              Duncan
            Your message has been successfully submitted and would be delivered to recipients shortly.