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

Generating SOAP::Fault detail elements

Expand Messages
  • Rich T_
    I m running into a wall on generating child elements within SOAP::Fault response. I can generate one child element just fine, but nothing I try will
    Message 1 of 4 , Jul 1, 2011
    • 0 Attachment
      I'm running into a wall on generating child elements within SOAP::Fault <detail> response. I can generate one child element just fine, but nothing I try will create multiple child elements. I've found examples online of this sort of output but no code to do it. Passing in a hashref or arrayref isn't doing it.

      I'm using the SOAP::Lite package and Perl 5.8. I'm generating the fault by calling die with a SOAP::Fault constructor. What I want is an output that looks like this:

      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Must pass start_time</faultstring>
      <detail>
      <result_code>116<result_code>
      <error_string>Missing start_time argument</error_string>
      <time>Fri Jul 1 15:45:06 UTC 2011</time>
      </detail>
      </soap:Fault>
      </soap:Body>
      </soap:Envelope>

      Any help would be appreciated.
      Thanks.
    • Mithun Bhattacharya
      ... perldoc seems to imply this type of construct should work for you - what error did you get for that ? - faultdetail(bless {code = 1} = BadError ) -
      Message 2 of 4 , Jul 1, 2011
      • 0 Attachment


        From: Rich T_ <rtomasso@...>

        I'm running into a wall on generating child elements within SOAP::Fault <detail> response. I can generate one child element just fine, but nothing I try will create multiple child elements. I've found examples online of this sort of output but no code to do it. Passing in a hashref or arrayref isn't doing it.

        perldoc seems to imply this type of construct should work for you - what error did you get for that ?

        ->
        faultdetail(bless {code => 1} => 'BadError')



        - Mithun
      • Rich T_
        ... That produces something like this: 1 Which is not what I want. I can get something like
        Message 3 of 4 , Jul 1, 2011
        • 0 Attachment
          --- On Fri, 7/1/11, Mithun Bhattacharya <inzoik@...> wrote:
          > perldoc seems to imply this type of construct should work for you -
          > what error did you get for that ?
          >
          > ->faultdetail(bless {code => 1} => 'BadError')


          That produces something like this:

          <detail>
          <BadError>
          <code>1</code>
          <BadError>
          <detail>

          Which is not what I want. I can get something like

          <detail>
          <code>1</code>
          <detail>

          Easily enough, but I want to have multiple child elements of <detail>
        • Mithun Bhattacharya
          ... How are you generating the above ? From: Rich T_ Which is not what I want. I can get something like 1
          Message 4 of 4 , Jul 1, 2011
          • 0 Attachment


            From: Rich T_ <rtomasso@...>

            Which is not what I want. I can get something like

            <detail>
                <code>1</code>
            <detail>
            How are you generating the above ?
          Your message has been successfully submitted and would be delivered to recipients shortly.