I am trying to throw a SOAPFaultException from an handler. Anyway I have some
weird error in what I get back.
I have tried the same code on java 6 without CXF and the handler chain works
differently (with java 1.6 works fine)
This is the handleMessage on my custom SOAPHandler (the way I fill the
SOAPFault is taken from the SUN tutorial):
1) WITH JAVA 6:
public boolean handleMessage(SOAPMessageContext ctx) {
Boolean outboundProperty = (Boolean) ctx
.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (!outboundProperty) {
SOAPMessage msg = ctx.getMessage();
SOAPBody body;
try {
body = msg.getSOAPBody();
SOAPFault fault = body.addFault();
QName faultName = new
QName(SOAPConstants.URI_NS_SOAP_ENVELOPE,
"Server");
fault.setFaultCode(faultName);
fault.setFaultActor("http://gizmos.com/orders");
fault.setFaultString("Server not responding");
Detail detail = fault.addDetail();
QName entryName = new
QName("http://gizmos.com/orders/",
"order", "PO");
DetailEntry entry =
detail.addDetailEntry(entryName);
entry.addTextNode("Quantity element does not
have a value");
QName entryName2 = new
QName("http://gizmos.com/orders/",
"order", "PO");
DetailEntry entry2 =
detail.addDetailEntry(entryName2);
entry2.addTextNode("Incomplete address: no zip
code");
throw new SOAPFaultException(fault);
} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}
and here is the log of the message sent back to the client. The SOAPFault is
populated correctly.
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>Server not responding</faultstring>
<faultactor>http://gizmos.com/orders</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">Quantity element does
not have a value</PO:order>
<PO:order xmlns:PO="http://gizmos.com/orders/">Incomplete address:
no zip code</PO:order>
</detail>
</soapenv:Fault>
2) WITH CXF + Java 5:
I have the same handler doing the same work. debugging the SOAPFault seems
to be populated correctly:
Anyway logging the answer here is what I get.
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server not responding</faultstring>
</soap:Fault>
The actor and expecially the details are missing.
I have tried debugging the org.apache.cxf.jaxws.handler.HandlerChainInvoker,
but I was not abel to figure out if there is some error somewhere.
Do you think it is a bug or an hidden error of mine?
Thanks a lot.
Davide
--
View this message in context:
http://www.nabble.com/SOAPFaultException%2C-maybe-a-bug-in-the-framework--tp15269025p15269025.html
Sent from the cxf-user mailing list archive at Nabble.com.