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

RE: [soaplite] Re: How to get errors

Expand Messages
  • Oeschey, Lars (I/ET-83, extern)
    ... string ... I also practically never used eval, so I don t know ;) ... The eval was a workaround, since without using it, I wouldn t get *anything* back in
    Message 1 of 15 , Oct 1, 2008
    • 0 Attachment
      > I'm not a great perl person, but doesn't using eval put the fault
      string
      > out of scope for the block in which you are attempting to print?

      I also practically never used eval, so I don't know ;)

      > I've always been able to get the error message back - and I
      > never use eval
      > (i understand that it is handy for trapping errors and not
      > crashing the script)

      The eval was a workaround, since without using it, I wouldn't get
      *anything* back in case of error, the http 500 error wouldn't even come
      back to me, and I had no idea if the call was successful.

      > also, why are you testing the error path through your code, or do
      > you really want to send a single param in your call ?
      > (as opposed to teInput("lala", "lulu");)

      hm, what do you mean?

      Lars
    • Oeschey, Lars (I/ET-83, extern)
      I got a bit further on this, though not very successful. Using the - trace method of SOAP::Lite, I could see what I m sending and receiving: sent:
      Message 2 of 15 , Oct 1, 2008
      • 0 Attachment
        I got a bit further on this, though not very successful. Using the
        ->trace method of SOAP::Lite, I could see what I'm sending and
        receiving:

        sent:

        <?xml version="1.0" encoding="UTF-8"?>
        <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.
        org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Body>
        <namesp1:teInput xmlns:namesp1="http://soap.data.inform.com">
        <c-gensym3 xsi:type="xsd:string">MAN9999999/1</c-gensym3>
        <c-gensym5 xsi:type="xsd:string">LAD1020</c-gensym5>
        <c-gensym7 xsi:type="xsd:int">1</c-gensym7>
        </namesp1:teInput>
        </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>

        received:

        <?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:Fault>
        <soap:faultcode>soap:Server</soap:faultcode>
        <soap:faultstring>IdSoapRpcXml.TIdSoapReaderXML.GetParameter: Parameter
        "in2" not found in list
        "c-gensym3,c-gensym5,c-gensym7"</soap:faultstring>
        <detail xsi:type="EIdSoapRequirementFail"></detail>
        </soap:Fault>
        </soap:Body>
        </soap:Envelope>

        looking at the wsdl file, I see that the third parameter should be
        string, while I send int (though I didn't do anything, somewhere it gets
        autotyped):

        <message name="teInput">
        <part name="in0" type="xs:string"/>
        <part name="in1" type="xs:string"/>
        <part name="in2" type="xs:string"/>
        </message>

        So this is the reason, why it's denied. But: Why don't I get the fault
        parameters? With this:

        use SOAP::Lite;# +trace => [qw(all)];
        my $soap= SOAP::Lite
        ->uri('http://soap.data.inform.com')
        ->proxy('http://audiinsa00220.in.audi.vwg:3003/soap/');

        my $som=$soap->teInput("MAN9999999/1", "LAD1020", "1");

        if ($som->fault) {
        print $som->faultdetail;
        print $som->faultcode;
        print $som->faultstring;
        print $som->faultactor;
        }

        I only get:
        500 Internal Server Error at soaptest.pl line 6

        and: How can I force the parameter to be a string?

        Lars
      • patrick mariani
        eval is typically used to catch a critical error - exactly as you said where perl does not return. the parameter missing error you are receiving is because it
        Message 3 of 15 , Oct 1, 2008
        • 0 Attachment
          eval is typically used to catch a critical error - exactly as  you said where perl
          does not return. 
           
          the parameter missing error you are receiving is because it expects two (3)
          args, and you were only sending one - now, you do need to get your
          error detection working - and i haven't had any problem printing
          the faultcode and strings -
           
          i recommend you read the wsdl with soap lite that will get the type correct.
          in your second response
           
          faultstring may only contain
          "500 Internal Server Error at soaptest.pl line 6"
           
          perhaps your server side code is bad?
           
           
          -
           
          ----- Original Message -----
          Sent: Wednesday, October 01, 2008 3:28 AM
          Subject: RE: [soaplite] Re: How to get errors

          > I'm not a great perl person, but doesn't using eval put the fault
          string
          > out of scope for the block in which you are attempting to print?

          I also practically never used eval, so I don't know ;)

          > I've always been able to get the error message back - and I
          > never use eval
          > (i understand that it is handy for trapping errors and not
          > crashing the script)

          The eval was a workaround, since without using it, I wouldn't get
          *anything* back in case of error, the http 500 error wouldn't even come
          back to me, and I had no idea if the call was successful.

          > also, why are you testing the error path through your code, or do
          > you really want to send a single param in your call ?
          > (as opposed to teInput("lala" , "lulu");)

          hm, what do you mean?

          Lars

        • Oeschey, Lars (I/ET-83, extern)
          ... as you can see from the post after that one (btw, this is the slowest list I know, not from participants but post speed, i.e. yahoo ;)), I ve been able to
          Message 4 of 15 , Oct 2, 2008
          • 0 Attachment
            > the parameter missing error you are receiving is because it
            > expects two (3)
            > args, and you were only sending one - now, you do need to get your
            > error detection working - and i haven't had any problem printing
            > the faultcode and strings -
            > i recommend you read the wsdl with soap lite that will get
            > the type correct.
            > in your second response

            as you can see from the post after that one (btw, this is the slowest
            list I know, not from participants but post speed, i.e. yahoo ;)), I've
            been able to trace sent and received stuff. I also managed meanwhile, to
            force the third parameter into "string" type, which can be seen with the
            trace. I still get the same error from the other side, which I blame on
            the server side now, but I still don't get the faultcode/string, and it
            definitely is sent (which is also seen in the trace mentioned in the
            previous mail)

            > faultstring may only contain
            > "500 Internal Server Error at soaptest.pl line 6"
            > perhaps your server side code is bad?

            maybe server-side code is bad... but the 500 Message comes not from
            *within* SOAP but is just the transport error (same as with a web
            server). I do see the SOAP fault in the trace, and it looks like it
            should be captured by SOAP::Lite, but it isn't...

            regards, Lars
          • rahed
            ... First don t input raw values to teInput function. Follow your service description. Something like this: my $som=$soap- teInput( SOAP::Data- name(in0 =
            Message 5 of 15 , Oct 4, 2008
            • 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'),
              );


              --
              Radek
            • 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 6 of 15 , Oct 6, 2008
              • 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 7 of 15 , Oct 6, 2008
                • 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 8 of 15 , Oct 8, 2008
                  • 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 9 of 15 , Oct 8, 2008
                    • 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.