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
  • 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 1 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.