-
1. Re: SoapFault
jim.ma Feb 7, 2012 1:08 AM (in response to poyge394)You need to create the soapFault with role, code and cause and throw it in a soapFaultExceptoin in the backend:
SOAPFactory factory = SOAPFactory.newInstance(); SOAPFault fault = factory.createFault("foo, new QName("http://foo", "FooCode")); //set code role, deatil ... throw new SOAPFaultException(fault);
Is this what you need ?
-
2. Re: SoapFault
poyge394 Feb 7, 2012 3:34 AM (in response to jim.ma)The usecase is this:
1) I call the a backend webservice.
2) I see on the wire i get this fault:
<faultcode>00001</faultcode> <faultstring>Kunduppgifter saknas</faultstring> <faultactor>KIS_Backend</faultactor> </soap:Fault> 3) In my client code I get
SOAPFaultException
Inside
SOAPFaultException (cause) i have
org.apache.cxf.binding.soap.SoapFault. I need that object for getting role, code and message. I see that thay contains:role = "KIS_Backend"
code = "00001"
faultstring = "Kunduppgifter saknas"
So the main problem is that i I can not get all the fault information from backend.
SOAPFaultException hase not the role and the code.
-
3. Re: SoapFault
poyge394 Feb 7, 2012 10:06 AM (in response to poyge394)hear is some debug information. shold't cxf mapp the fault to the SOAPFault ? evrything seams to be null hear.
SOAPFault soapFault = se.getFault();
soapFault = {com.sun.xml.internal.messaging.saaj.soap.ver1_1.Fault1_1Impl@686}"[SOAP-ENV:Fault: null]"
faultStringElement = {com.sun.xml.internal.messaging.saaj.soap.ver1_1.FaultElement1_1Impl@697}"[faultstring: null]"
faultActorElement = {com.sun.xml.internal.messaging.saaj.soap.ver1_1.FaultElement1_1Impl@698}"[faultactor: null]"
faultCodeElement = {com.sun.xml.internal.messaging.saaj.soap.ver1_1.FaultElement1_1Impl@699}"[faultcode: null]"
detail = null
encodingStyleAttribute = {com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl$AttributeManager@700}
elementQName = {javax.xml.namespace.QName@701}"{http://schemas.xmlsoap.org/soap/envelope/}Fault"
namespaceURI = {java.lang.String@702}"http://schemas.xmlsoap.org/soap/envelope/"
localName = {java.lang.String@703}"Fault"
type = null
name = {java.lang.String@704}"SOAP-ENV:Fault"
attributes = {com.sun.org.apache.xerces.internal.dom.AttributeMap@705}
ownerDocument = {com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl@707}"[#document: null]"
firstChild = {com.sun.xml.internal.messaging.saaj.soap.ver1_1.FaultElement1_1Impl@699}"[faultcode: null]"
fNodeListCache = null
fBufferStr = null
previousSibling = null
nextSibling = null
ownerNode = {com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl@707}"[#document: null]"
-
4. Re: SoapFault
poyge394 Feb 8, 2012 4:24 AM (in response to poyge394)The problem was on my part. soapFault actually contains the value of role, code and message. I misinterpreted what debugger meand by null (I think the null is only the qualified name) , the content was not null.