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

SOAP Faults and HTTP 1.1 error codes

Expand Messages
  • Alceu R
    Hello there, My name is Alceu and I m a newbie with SOAP::Lite. I was adding some parameter validation in server side and follow the explanations on
    Message 1 of 1 , Apr 27, 2011
      Hello there,

      My name is Alceu and I'm a newbie with SOAP::Lite.

      I was adding some parameter validation in server side and follow the explanations on http://cookbook.soaplite.com/#soap%20faults about how to setup error codes to give better explanations about the invalid parameters.

      Everything looks fine, but I'm alway getting an HTTP 500 error in the HTTP header:

      SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x136a3fc)
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
      Connection: close
      Date: Wed, 27 Apr 2011 15:48:08 GMT
      Server: Apache/2.2.17 (Win32)
      Content-Length: 637
      Content-Type: text/xml; charset=utf-8
      Client-Date: Wed, 27 Apr 2011 15:48:09 GMT
      Client-Response-Num: 1
      SOAPServer: SOAP::Lite/Perl/0.712

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:namesp1="http://namespaces.soaplite.com/perl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/so
      ap/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><soap:Fault><fa
      ultcode>soap:Server.Custom</faultcode><faultstring>Invalid state string: 'ef'</faultstring><detail><BadState xsi:type="namesp1:BadState"><code xsi:type="xsd:int">1</code></BadState></detail></soap:Fault>

      While the SOAP fault code looks ok, I'm wondering if the HTTP header is the correct one. Of course, Since I'm using die function in the CGI built to run in my Apache webserver, it seems more resonable that the HTTP error should be "400 Bad Request" since the server was able to process the request, but the parameter(s) is(are) invalid.

      So my first question is: should I worry about that?
      Question 2: if I should, how should I change that?

      I'm using SOAP::Transport::HTTP::CGI in the server side to process the requests.

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