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

RE: [soaplite] Re: How to get errors

Expand Messages
  • Oeschey, Lars (I/ET-83, extern)
    ... great, this works! Thanks a lot! Would you mind explaining what the difference is now? Can I maybe read up somewhere about generic Soap handling? It seems
    Message 1 of 15 , Oct 6, 2008
    View Source
    • 0 Attachment
      > > <message name="teInput">
      > > <part name="in0" type="xs:string"/>
      > > <part name="in1" type="xs:string"/>
      > > <part name="in2" type="xs:string"/>
      > > </message>
      >
      > First don't input raw values to teInput function. Follow your service
      > description.
      > Something like this:
      >
      > my $som=$soap->teInput(
      > SOAP::Data->name(in0 =>
      > 'MAN9999999/1'),
      > SOAP::Data->name(in1 =>
      > 'LAD1020'),
      > SOAP::Data->name(in2 =>
      > 1)->type('string'),

      great, this works! Thanks a lot! Would you mind explaining what the
      difference is now? Can I maybe read up somewhere about generic Soap
      handling? It seems my fault was just not following "best practice", so
      I'd like to know what "best practice" would be ;)

      Lars
    • Oeschey, Lars (I/ET-83, extern)
      ... This works good for the positive case (i.e. all values are good). If I want to get an error, by sending the last value as string, I should get an error
      Message 2 of 15 , Oct 6, 2008
      View Source
      • 0 Attachment
        > First don't input raw values to teInput function. Follow your service
        > description.
        > Something like this:
        >
        > my $som=$soap->teInput(
        > SOAP::Data->name(in0 =>
        > 'MAN9999999/1'),
        > SOAP::Data->name(in1 =>
        > 'LAD1020'),
        > SOAP::Data->name(in2 =>
        > 1)->type('string'),

        This works good for the positive case (i.e. all values are good). If I
        want to get an error, by sending the last value as string, I should get
        an error from $som->fault however. I only get a http 500 error. The
        trace contains the fault though:

        <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:soapenc="http://schemas.xmlsoap.org/s
        oap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:soap="http://schemas.
        xmlsoap.org/soap/envelope/"><soap:Body><teInput
        xmlns="http://soap.data.inform.com"><in0
        xsi:type="xsd:string">MAN9999999/1</in0><in1 xsi:type="xsd:st
        ring">LAD22010</in1><in2
        xsi:type="xsd:int">1</in2></teInput></soap:Body></soap:Envelope>
        SOAP::Transport::HTTP::Client::send_receive:
        HTTP::Response=HASH(0x1e38270)
        SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal
        Server Error
        Cache-Control: proxy-revalidate
        Connection: close
        Date: Mon, 06 Oct 2008 13:44:41 GMT
        Server: Indy/9.0.18
        Content-Length: 689
        Content-Type: text/xml; charset=utf-8
        Client-Date: Mon, 06 Oct 2008 13:44:40 GMT
        Client-Peer: 10.250.52.241:8080
        Client-Response-Num: 1

        <?xml version="1.0" encoding="UTF-8"?>
        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xs="http://www.
        w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:F
        ault><soap:faultcode>soap:Server</soap:faultcode><soap:
        faultstring>Type Mismatch. For the parameter in2, the type found was
        "int" in the namespace
        "http://www.w3.org/2001/XMLSchema", which
        doesn't match any of the expected values:
        {http://www.w3.org/2001/XMLSchema}string</soap:faultstring><detail
        xsi:type="EIdSoapRequirementFail"></d
        etail></soap:Fault></soap:Body></soap:Envelope>

        I'm trying to get the fault like this:

        if ($som->fault) {
        print $som->faultdetail; # returns value of 'detail' element as
        # string or object
        print $som->faultcode; #
        print $som->faultstring; # also available
        print $som->faultactor; #
        }
        else {print "result:$som\n";}
      • rahed
        ... You should get the fault this way. You may changed the $som object before calling a fault method. -- Radek
        Message 3 of 15 , Oct 8, 2008
        View Source
        • 0 Attachment
          > I'm trying to get the fault like this:
          >
          > if ($som->fault) {
          > print $som->faultdetail; # returns value of 'detail' element as
          > # string or object
          > print $som->faultcode; #
          > print $som->faultstring; # also available
          > print $som->faultactor; #
          > }
          > else {print "result:$som\n";}

          You should get the fault this way. You may changed the $som object
          before calling a fault method.


          --
          Radek
        • rahed
          ... A request expects a soap structure which is done by SOAP::Data class. Check the SOAP::Lite docs. -- Radek
          Message 4 of 15 , Oct 8, 2008
          View Source
          • 0 Attachment
            > great, this works! Thanks a lot! Would you mind explaining what the
            > difference is now? Can I maybe read up somewhere about generic Soap
            > handling? It seems my fault was just not following "best practice", so
            > I'd like to know what "best practice" would be ;)

            A request expects a soap structure which is done by SOAP::Data class.
            Check the SOAP::Lite docs.

            --
            Radek
          Your message has been successfully submitted and would be delivered to recipients shortly.