Wednesday, 11 May 2011

WAS SOAPFault causing throws a WebServicesFault

When returning a SOAPFault from a SOAP handler I saw this in Websphere Application Server's (6.1.0) console:
[11/05/11 18:20:51:654 EST] 00000047 WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet doPost WSWS3227E:  Error: Exception:
                                 WebServicesFault
 faultCode: 666
 faultString: myfaultstring
 faultActor: myhandler
 faultDetail: 

myfaultstring
 at com.ibm.ws.webservices.engine.xmlsoap.builders.WebServicesFaultProcessor.createFault(WebServicesFaultProcessor.java:420)
 at com.ibm.ws.webservices.engine.xmlsoap.SOAPFault.getFault(SOAPFault.java:615)
 at com.ibm.ws.webservices.engine.SOAPPart.getFault(SOAPPart.java:1097)
 at com.ibm.ws.webservices.engine.SOAPPart.getFault(SOAPPart.java:754)
 at com.ibm.ws.webservices.engine.Message.getFault(Message.java:935)
 ....
Or when throwing a custom SOAPFaultException:
[11/05/11 18:32:05:678 EST] 00000065 WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet doPost WSWS3227E:  Error: Exception:
                                 WebServicesFault
 faultCode: myWebServiceFunction
 faultString: my test
 faultActor: testActor
 faultDetail: 

my test
 at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java:189)
 at com.ibm.ws.webservices.engine.dispatchers.java.SessionDispatcher.invoke(SessionDispatcher.java:213)
 at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:248)
 ...

A SOAP fault is still returned to the client but you get a WebServicesFault exception on both ends. Digging into Websphere's with the help of a decompiler shows that this is caused simply by no fault detail being passed. Simply adding a fault detail with a text of "error" gets rid of this error.