cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malisetti, Ramanjaneyulu" <Ramanjaneyulu.Malise...@ca.com>
Subject RE: creating SoapFault with custom exceptions
Date Tue, 13 Dec 2011 09:59:26 GMT
Thank you Willem.

I'll try out.

Regards
Raman

-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com] 
Sent: Tuesday, December 13, 2011 2:49 PM
To: users@cxf.apache.org
Subject: Re: creating SoapFault with custom exceptions

Hi,

You can find some information about it here[1]

[1]http://willemjiang.blogspot.com/2011/01/how-to-map-soap-fault-message-with.html


On 12/12/11 7:59 PM, Malisetti, Ramanjaneyulu wrote:
> Hi
>       we have the  following code to create SoapFault for sending server side exception
to client. On client side, detail part coming as Null. I see some posts in CXF forum on this
issue and addressed as issue has been solved. We are using CXF 2.3.0
>
>
>             SOAPMessage response = msgFactory.createMessage();
>              CustomException cusEx = (CustomException) ((ex instanceof CustomException)
? ex
>                          : new CustomException (ex));
>              try {
>                    response.getSOAPBody().addNamespaceDeclaration("ns1",
>                                "http://com.test.ns1");
>                    response.getSOAPBody().addNamespaceDeclaration("ns2",
>                                "http://com.test.ns2");
>
>                    WSAddressingUtil.addHeader(response, WSAddressingUtil.ACTION,
>                                WSTransferUtil.TRA_FAULT);
>                    SOAPFault fault = response.getSOAPBody().addFault();
>                    fault.setFaultActor("ns2:Sender");
>                    fault.setFaultCode("ns1:UnsupportedData");
>                    fault.setFaultString("The data specified on the request message is
not supported "
>                                + "by the endpoint.");
>                    fault.addDetail().addTextNode(Util.getStackTrace(cusEx));
>              } catch (Exception e) {
>                    e.printStackTrace()
>              }
>
> IS there anything wrong with this code?
>
>
> Thanks
>
> Regards
> Raman
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message