Sorry for coming late.
g tsuji wrote:...If the client is coded in JAX-WS approach, it often happens to capture the lower level SOAPMessageContext via a handler within the handler chain. In any case, once you get a handler of SOAPMessage, you can obtain in consequence easily SOAPBody, and hence SOAPFault by .getFault() method.
Once you have the instance of SOAPFault (say, sFault), the instance of detail element (say, detail) is only one step away by sFault.getDetail()...
Thank you g tsuji for your inputs. :)
The client is indeed built using JAX-WS.
I have tried putting a handler, but in my case flow is not coming at all inside "
handleMessage(SOAPMessageContext context) method" in case of inbound, nor flow is coming inside "
handleFault(SOAPMessageContext context) method".
NOTE: Handler is working fine as outbound flow is logged properly.
Further updates:
At server side they have repaired the SOAP fault response, now it is looking something like this, which conforms the XSD, so valid.
Still I am not getting a SOAP fault in my JAX-WS client, but getting HTTP 401.
After few hours of search, we came across following.
JAX-WS conforms to “WS-I Basic Profile 1.1”, which says HTTP status code must be 500 in case of any SOAP fault. Then only client will get a SOAP fault.
In our case though server is sending correct format of SOAP fault, yet it is sending HTTP status code 401 for expired token.
Because of this, the client is unable to get SOAP fault sent by server.
So now I think, if I want to keep web service client unchanged, server has to send HTTP 500 instead of HTTP 401 in my case.
If not possible, next option may be server sends the fault "detail" in HTTP header so that I get the information using "
javax.xml.ws.handler.MessageContext.HTTP_RESPONSE_HEADERS".
Kindly share if anyone has anything more to add.
Reference links for the above findings.
https://mxforum.mendix.com/questions/5740/Your-opinion-on-HTTP-status-codes-for-webservice-faultshttp://www.ws-i.org/profiles/basicprofile-1.1-2004-08-24.htmlhttps://docs.oracle.com/javaee/6/tutorial/doc/bnazd.html