I am getting SOAPFaultException on the fly and getting cause of the exception. This cause contains XML string to find out respective fault string.
How do i parse and feed soapfaultexception or cause into xpath methods?
How do I get value from the following node faultstring which is 3 layers down
From the SOAPFaultException you can get a SOAPFault object, which contains information about the SOAP fault.
To obtain the data you mentioned in your posting, use the following methods on the SOAPFault object:
- Detail information: getDetail
This method will return a Detail object, which may contain multiple detail entries.
- Fault string: getFaultString
I don't know what ReceivedFaultDetail is, but I do not think it is necessary to use XPath to extract information from the SOAP fault.
As you explained, I’m going to use the workaround that you mentioned in your post. But I'm stuck. Can you use my soapfaultexception provided in my previous post and write a code snippet for me to use it for my application. I’m not sure how do I get soapfault and retrieve the soap fault string. I need your guidance and a little bit of explanation. Perhaps i need your code. It will be greatly appreciated, if you spend a little bit of time to help me to resolve this issue and understanding that required for this resolution. In future, I can make use of your help that provided now in many places...
Sincerely thanking you. Only a few people turn their head towards the people who really in need.
A Detail object obtained from the SOAPFault object is a DOM Node, so there are many opportunities to obtain information about the node etc etc.
The original question was how to obtain the SOAP fault string, which is what will be placed in the theSOAPFaultString after having executed the above code snippet.
there is no method to get soapfault object from SOAPFaultException. There is a method getDetail() in SOAPFaultException. the one class I imported is as given above. How did you get
SOAPFault theFault = theException.getFault();
the following are the methods
Can you please tell me which class you imported?
I presume that the faultstring retrieval that you mentioned above is at first layer. But mine is at a few layers down. You could see the xml string provided.
I have been looking at the classes in the JavaSE 6 API only.
Which web service stack do you use?