S:Server " /> S:Server " /> S:Server "/>

Getting stream closed error for get the details of SoapFaultClientException in weblogic 12c

137 Views Asked by At

I am trying to get the values inside this soap fault's "detail".

The response from the server:

<S:Fault>
     <faultcode>S:Server</faultcode>
     <faultstring>AuthException</faultstring>
     <detail>
        <ns2:AuthException xmlns:ns2="url...">
           <code>0</code>
           <failCause>INVALID_AMOUNT</failCause>
           <message>AuthException</message>
        </ns2:AuthException>
     </detail>
  </S:Fault>

The following code works correctly but only when the project runs under tomcat, in other words when the project run under the weblogic , I get "com.ctc.wstx.exc.WstxIOException: Stream closed" error.

catch (SoapFaultClientException e) {
    SoapFaultDetail soapFaultDetail = e.getSoapFault().getFaultDetail(); 
    if (soapFaultDetail == null) {
        throw e;
    }
    SoapFaultDetailElement detailElementChild = soapFaultDetail.getDetailEntries().next();
    Source detailSource = detailElementChild.getSource();
    Object detail = webServiceTemplate.getUnmarshaller().unmarshal(detailSource);
    JAXBElement<serviceException> source = (JAXBElement<serviceException>)detail;
    System.out.println("failCause:"+source.getFailCause());  
}
0

There are 0 best solutions below