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

Re: How to get errors

Expand Messages
  • Lamar Hawkins
    You will find that the 500 Internal Server Error is returned for many cases where there is a problem on the server side like missing parameters or
    Message 1 of 15 , Sep 25, 2008
    • 0 Attachment
      You will find that the "500 Internal Server Error" is returned for
      many cases where there is a problem on the server side like missing
      parameters or restrictive file permissions. The 500 error is what I
      would expect for the situation you describe.

      It would be nice to get something more descriptive from SOAP.
      However, the error condition you describe is not a problem with SOAP
      (transport), but a problem with the service/subroutine itself. If
      you have access to the parameter list on the server side before it's
      (automatically?) parsed, you should be able to check that list and
      return your own SOAP error code and string if parameters are missing
      or invalid.

      --- In soaplite@yahoogroups.com, "Oeschey, Lars (I/ET-83, extern)"
      <extern.lars.oeschey@...> wrote:
      >
      > > Try the following syntax:
      >
      > very nice, that works...
      >
      > another question, I didn't write the server part, but I have a
      feeling
      > that it's not correctly implemented.
      > If I give a wrong set of parameters to the SOAP Server, I'm just
      getting
      > the http 500 Error. Though I think, I should get something in
      > SOAP->faultcode and SOAP->faultstring to give a better Error
      Message.
      > When the server is down, I get a http 503 Error, which is OK and
      should
      > be the only case I get a http Error. Internally the SOAP Server
      logs a
      > correct Error, i.e.
      >
      > 25.09.2008 9:33:27 [ERROR] TIdSoapServer.HandleSoapRequest():
      > IdSoapRpcXml.TIdSoapReaderXML.GetParameter: Parameter "in2" not
      found in
      > list "c-gensym3"
      >
      > (that means parameter in2 is missing), shouldn't I get something
      like
      > this back to the client?
      >
      > Lars
      >
    • Oeschey, Lars (I/ET-83, extern)
      ... hm, I asked the company that is responsible for the server side of the SOAP I use. They told me they send a faultcode etc., it looks like this: HTTP/1.1
      Message 2 of 15 , Sep 30, 2008
      • 0 Attachment
        > You will find that the "500 Internal Server Error" is returned for
        > many cases where there is a problem on the server side like missing
        > parameters or restrictive file permissions. The 500 error is what I
        > would expect for the situation you describe.
        > It would be nice to get something more descriptive from SOAP.
        > However, the error condition you describe is not a problem with SOAP
        > (transport), but a problem with the service/subroutine itself. If
        > you have access to the parameter list on the server side before it's
        > (automatically?) parsed, you should be able to check that list and
        > return your own SOAP error code and string if parameters are missing
        > or invalid.

        hm, I asked the company that is responsible for the server side of the
        SOAP I use. They told me they send a faultcode etc., it looks like this:

        HTTP/1.1 500 Internal Server Error
        Connection: close
        Content-Type: text/xml; charset=utf-8
        Content-Length: 561
        Server: Indy/9.0.18
        <?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 ""
        </soap:faultstring>
        <detail xsi:type="EIdSoapRequirementFail"></detail>
        </soap:Fault>
        </soap:Body>
        </soap:Envelope>

        However with your example code

        use SOAP::Lite;
        $soap= SOAP::Lite
        ->uri('http://soap.data.inform.com')
        ->proxy('http://soapserver.tld:3003/soap/');

        eval {$soapReply = $soap->teInput("lala,lulu");};
        if ($@) {
        chomp ($@);
        print "Server Error ->" . $@ . "<-...skipping";
        }
        elsif ($soapReply->fault) {
        print "Fault code from function ->" .
        $soapReply->faultcode . "<-";
        print "Fault string from function ->" .
        $soapReply->faultstring . "<-...skipping";
        }
        else {
        print $soapReply;
        }

        I get nothing more than the 500 Server error. I think I should also get
        the soap->faultcode etc., something must be still wrong on my side
        then...
      • pat.mariani@att.net
        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 ve always been able
        Message 3 of 15 , Sep 30, 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'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)
           
          someone more perlwise help out here?
           
          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" );)
           
           
          -------------- Original message from "Oeschey, Lars (I/ET-83, extern)" <extern.lars.oeschey@...>: --------------

          > You will find that the "500 Internal Server Error" is returned for
          > many cases where there is a problem on the server side like missing
          > parameters or restrictive file permissions. The 500 error is what I
          > would expect for the situation you describe.
          > It would be nice to get something more descriptive from SOAP.
          > However, the error condition you describe is not a problem with SOAP
          > (transport), but a problem with the service/subroutine itself. If
          > you have access to the parameter list on the server side before it's
          > (automatically? ) parsed, you should be able to check that list and
          > return your own SOAP error code and string if parameters are missing
          > or invalid.

          hm, I asked the company that is responsible for the server side of the
          SOAP I use. They told me they send a faultcode etc., it looks like this:

          HTTP/1.1 500 Internal Server Error
          Connection: close
          Content-Type: text/xml; charset=utf- 8
          Content-Length: 561
          Server: Indy/9.0.18
          <?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
          &#34;in2&#34; not found in list &#34;&#34;
          </soap:faultstring>
          <detail xsi:type="EIdSoapRe quirementFail" ></detail>
          </soap:Fault>
          </soap:Body>
          </soap:Envelope>

          However with your example code

          use SOAP::Lite;
          $soap= SOAP::Lite
          ->uri('http://soap. data.inform. com')
          ->proxy('http://soapserver. tld:3003/ soap/');

          eval {$soapReply = $soap->teInput( "lala,lulu" );};
          if ($@) {
          chomp ($@);
          print "Server Error ->" . $@ . "<-...skipping" ;
          }
          elsif ($soapReply- >fault) {
          print "Fault code from function ->" .
          $soapReply-> faultcode . "<-";
          print "Fault string from function ->" .
          $soapReply-> faultstring . "<-...skipping" ;
          }
          else {
          print $soapReply;
          }

          I get nothing more than the 500 Server error. I think I should also get
          the soap->faultcode etc., something must be still wrong on my side
          then...

        • 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 4 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 5 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 6 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 7 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 8 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 9 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 10 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 11 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 12 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.