Hmm.... I THINK what I would do is write an interceptor that would be:
super(Phase.UNMARSHAL);
addBefore(Soap12FaultInInterceptor.class.getName());
(obviously, it goes in the InFaultChain)
It would just do something like: (pseudo code)
XMLStreamReader reader = message.getContent(XMLStreamReader.class);
StreamFilter filter = new StreamFilter() {
public boolean accept(XMLStreamReader reader) {
return true;
}
};
XMLStreamReader newReader = new FilteredStreamReader( reader, filter) {
public QName getName() {
QName qn = mReader.getName();
if ("detail".equals(qn.getLocalPart())) {
qn = new QName(soap12ns, "Detail");
}
return qn;
}
public String getLocalName() {
return getName().getLocalPart();
}
public String getNamespaceURI() {
return getName().getNamespaceURI();
}
};
message.setContent(XmlStreamReader.class, newReader);
Basically, this will make the XmlStreamReader remap the bogus detail
element qname into the proper soap 1.2 Detail element. It should
leave the rest of the stuff alone.
Dan
On May 14, 2008, at 2:41 PM, tywebb wrote:
Dan,
Thank you again for helping me debug. I was afraid this was the
case. The
problem is I don't control/own the web service. I assume writing my
own
Interceptor would be one way of handling this invalid response, but
after
reading the documentation and playing around with creating an
interceptor I
haven't had much luck. What "Phase" would be best suited for this
type of
Interceptor? What is the best way to retrieve and parse the
message.getContent()? XMLStreamReader? Any guidance you could
provide
would be sincerely appreciated.
Thanks
dkulp wrote:
While debugging this, I just realized that the soap fault in your
message is NOT a valid soap 1.2 fault. That's why it's not finding
the details. For SOAP 1.2, the details element needs to be
<soap:Detail>, not <details>. If you have access to the service,
you
should definitely get it updated to generate correct 1.2 faults.
Anyway, I'm going to say, as far as CXF is concerned, "not a bug".
Dan
On May 13, 2008, at 5:42 PM, tywebb wrote:
Dan,
Thank you for your replay. Unfortunately this is precisely the
problem I am
having. I would expect, as you did, that the contents of the
<detail> tag
(see my payload example) be accessible through
sfe.getFault().getDetail().getDetailEntries() but getDetailEntries
and all
other seemingly relevant methods return null. Any other thoughts?
Thanks
dkulp wrote:
sfe.getFault().getDetail().getDetailEntries() should return an
Iterator that allows you to iterate over the detail contents.
Note: The Detail object returned from sfe.getFault().getDetail()
implements the org.w3c.dom.Element stuff so any of the XML apis
should
be able to be used to process it.
Dan
On May 9, 2008, at 12:27 PM, tywebb wrote:
I am using CXF 2.1 generated clients to consume web services
written
in .NET.
The application previously used Apache Axis1 (v 1.4) to consume
these same
web services and I did not encounter this issue. Unfortunately, I
have no
control over the content or structure of the WSDL's so I am hoping
the issue
does lie there.
When calling our login web service, the server will return "error"
messages
embedded in the soap payload that I can use to build Java
Exceptions. With
Axis i was easily able to catch org.apache.axis.AxisFault
exceptions
and
parse its "faultDetails" to retrieve the information I need.
When calling these same services with CXF generated clients, I
recieve a
javax.xml.ws.soap.SOAPFaultException but I am unable to find the
error
details anywhere in that object graph.
Below is the Inbound payload CXF logs after a failed login
attempt.
All I
want/need is access to the data wrapped in the <detail> tag. I
was
able to
do this quite easily with Axis with no special configuration.
What
am I
missing that is preventing me from getting this information out of
CXF/SOAPFaultException
CXF Inbound Payload...
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-
envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">SOAP Fault Occurred</
soap:Text>
</soap:Reason>
<detail>
<ServiceMethod></ServiceMethod>
<ErrorCode>-200</ErrorCode>
<ErrorMessage>INVALID USER LOGIN ID</ErrorMessage>
<ErrorDump>Exception Handled By Database</ErrorDump>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
--
View this message in context:
http://www.nabble.com/SOAPFaultException-missing-custom-error-data-tp17151614p17151614.html
Sent from the cxf-user mailing list archive at Nabble.com.
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog
--
View this message in context:
http://www.nabble.com/SOAPFaultException-missing-custom-error-data-tp17151614p17219031.html
Sent from the cxf-user mailing list archive at Nabble.com.
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog
--
View this message in context:
http://www.nabble.com/SOAPFaultException-missing-custom-error-data-tp17151614p17238204.html
Sent from the cxf-user mailing list archive at Nabble.com.
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog