Hi,

You mentioned 
"e.getFaultInfo() will return AddNumbersExceptionBean", this reveal that you're 
not using CXF(probably you're using metro). Please double check and ensure your 
both client and server are using CXF.

And as CXF, if there's no FaultBean in @webFault and no getFaultInfo method in 
Exception class, currently CXF will put the exception class itself as the 
FaultBean, so you need ensure field in AddNumbersException could be marshaled 
correctly by jaxb, so just add @XmlAccessorType(XmlAccessType.FIELD) in 
AddNumbersException can do the trick, this way the exception message "Sum is 
less than 0." could be return to client.
 
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-10-17, at 下午3:47, iris ding wrote:

> Hi FreeMan,
> 
> sorry there is a typo in my test code, it actually should be : --not with
> "_Exception"
> 
> } catch (AddNumbersException e) {    
>                System.out.println(e.getFaultInfo().getInfo());
>       }
> 
> the  AddNumbersException can be caught ,  e.getFaultInfo() will return
> AddNumbersExceptionBean, but within AddNumbersExceptionBean, the field
> "info" and "message" is null.
> 
> the soap message is as below:
> - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
> - <soap:Body>
> - <soap:Fault>
>  <faultcode>soap:Server</faultcode> 
>  <faultstring>Fault occurred while processing.</faultstring> 
> - <detail>
>  <ns1:AddNumbersException xmlns:ns1="http://server.iristest.faultbean/"; /> 
>  </detail>
>  </soap:Fault>
>  </soap:Body>
>  </soap:Envelope>
> 
> 
> 
> 
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><a:addNumbers
> xmlns:a="http://server.iristest.faultbean/";><arg0>1</arg0><arg1>-2</arg1></a:addNumbers></soapenv:Body></soapenv:Envelope>
> 
> Thanks a lot!
> 
> 
> 
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Webfault-tp5716784p5716799.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to