Friday 15 February 2013

soap - Sending different error messages from web service -


I wrote a web service using the cxf web service. I want to send different error messages to the client. I have a way and this method returns an object if everything is fine. Receives the parameters if the parameter is incorrect, the method must send a different message but I can not change the method of returning the method so that I can not send different things. How can I do this?

Try to use exceptions within the Java annotation CXF system you can return an exception if It looks like:

  import javax.xml.ws.WebFault; @WebFault (name = "UsageMyException") increases the public class MyException exception {Private Static last long serial VERSIONUID = 1L; Public My Exclusion (Ultimate String String) {Super}; } Public My Exception (Last Exception E) {Super (E); }}   

You can use more than one exception which extends to each other Exception FaultMessage

No comments:

Post a Comment