Topic
2 replies Latest Post - ‏2012-12-30T07:31:34Z by fjb_saper
Powerss
Powerss
7 Posts
ACCEPTED ANSWER

Pinned topic Soap Fault Handling in JavaCompute Node using MBElement

‏2012-12-26T16:13:06Z |
Hi,
I received the below Fault response from a webservice.

Response:
<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>ArgumentInvalid</faultcode>
<faultstring>There is no unique</faultstring>
<faultactor></faultactor>
<detail>
<ExceptionType>InvalidException</ExceptionType>
<ExceptionCode>ArgumentInvalid</ExceptionCode>
<Message>There is no unique </Message>
<ErrorId>-1000</ErrorId>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I did a soap Extract and got only the response
from the MBAssembly using the below code.

inboundResponseXml = new String(msgBytes, "UTF-8");
inboundResponseXml :
==================
<NS1:Fault xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>ArgumentInvalid</faultcode>
<faultstring>There is no unique</faultstring>
<faultactor></faultactor>
<detail>
<ExceptionType>InvalidException</ExceptionType>
<ExceptionCode>ArgumentInvalid</ExceptionCode>
<Message>There is no unique </Message>
<ErrorId>-1000</ErrorId>
</detail>
</NS1:Fault>

Is there any way to parse this String into respective element so that i can get the values and map it to the another
XML.
Thanks,
Updated on 2012-12-30T07:31:34Z at 2012-12-30T07:31:34Z by fjb_saper
  • Powerss
    Powerss
    7 Posts
    ACCEPTED ANSWER

    Re: Soap Fault Handling in JavaCompute Node using MBElement

    ‏2012-12-26T16:40:59Z  in response to Powerss
    Thanks. I was able to map the SOAP Fault values using the "FaultDocument".

    FaultDocument faultDocument = FaultDocument.Factory.parse(inboundResponseXml);
    • fjb_saper
      fjb_saper
      120 Posts
      ACCEPTED ANSWER

      Re: Soap Fault Handling in JavaCompute Node using MBElement

      ‏2012-12-30T07:31:34Z  in response to Powerss
      Wrong way to do this. You are not leveraging the broker's capability to parse XML...

      So you always expect an XML content to your MbElement.
      Retrieve the XML content -- you did good there,

      Then use the CreateLastElementfromBitstream method...(message broker way)...