This content has been marked as final.
Show 3 replies
-
1. Re: Sending Custom Response for CXF webservice
jim.ma Aug 16, 2012 3:41 AM (in response to kishor_pawar89)You can either re-write your sevice endpoint inerface/implementation to return a response object you want , or configure the cxf transformfeature to modify the fault response : http://cxf.apache.org/docs/transformationfeature.html
-
2. Re: Sending Custom Response for CXF webservice
pbielicki Dec 11, 2013 9:08 AM (in response to kishor_pawar89)Hi Kishor,
did you solve this issue? I'm having the same issue, and am figthing with CFX at the moment not to send soap:Fault but a custom body.
Cheers,
Przemyslaw
-
3. Re: Sending Custom Response for CXF webservice
pvivacqua Dec 20, 2013 8:23 AM (in response to kishor_pawar89)Hello Kishor,
In our CXF implementations we usually return a Response object with a customized message from a message.properties file depending on the exceptions that our WS throws. In a very simplified way, you might do something like this.
In our SEI we have a method that calls our meditator
public ResponseTest doTheThing(RequestTest requestTest) { ResponseTest responseTest = thingMediator.add(requestTest); return response; }
mediator
public ResponseTest add(RequestTest requestTest) { ResponseTest responseTest = new ResponseTest(); try { ... calls your business rules ... } catch (Exception se) { return responseTest.setMessage("Something went wrong"); } return responseTest.setMessage("Success"); }
response class
public class ResponseTest { private String message public String getMessage(){ return message; } public void setMessage(String message){ this.message = message } {