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

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

Expand Messages
  • Rushikesh Joshi
    Thanks for your reply........... See below is my code to call my webservices method ######################### Code Starts ##################################
    Message 1 of 8 , Aug 19, 2004
    • 0 Attachment

      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 2 of 8 , Aug 20, 2004
      • 0 Attachment
        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.