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

Serializing SOAP::Fault

Expand Messages
  • Sergey Romanovsky
    Hi, I need to throw an error which should be caught by a .NET client of SOAP::Lite webservice. Serialized SOAP::Fault produces xml which isn t compatible with
    Message 1 of 1 , Apr 9 10:31 AM
    • 0 Attachment
      Hi,

      I need to throw an error which should be caught by a .NET client of SOAP::Lite webservice.
      Serialized SOAP::Fault produces xml which isn't compatible with .NET library.

      $ perl -e 'use SOAP::Lite; print SOAP::Serializer->envelope( fault=>SOAP::Fault->new(faultstring=>"foo",faultcode=>"bar"))'
      <?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/soap/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>
                  <faultcode xsi:type="namesp1">
                      <_faultstring xsi:type="xsd:string">foo</_faultstring>
                      <_faultcode xsi:type="xsd:string">bar</_faultcode>

                  </faultcode>
                  <faultstring xsi:nil="true" />
              </soap:Fault>
          </soap:Body>
      </soap:Envelope>


      Is there any chance to get something like the following by standard means of SOAP::Lite?

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <soap:Body>
            <soap:Fault>
               <faultcode>foo</faultcode>
               <faultstring>bar</faultstring>

               <detail/>
            </soap:Fault>
         </soap:Body>
      </soap:Envelope>

      The main thing that confuse me with the first sample above is subelements like "_faultstring".
      What for it? Why not just plain elements like <faultstring>? Is there any standards for this?

      Thanks for your help!
    Your message has been successfully submitted and would be delivered to recipients shortly.