throwing exceptions->faults from SOAP service Java with GlassFish [duplicate]
题
Possible Duplicate:
JAX-WS - Map Exceptions to faults
I do not normally use java, but I being forced to write a service wrapper around a 3rd party library that I need. (So I can call it from c#)
I am using NetBeans with GlassFish, and I was wondering how to work with SOAP Faults in there.
@WebMethod(operationName = "hello")
public String hello() throws Exception
{
return "Hello World!";
}
How do I change this so that any exceptions thrown inside hello() get turned into Faults? Even a single fault that just contains the exception message will do for now.
I really just have no idea how to deal with faults in this environment... any information will help.
解决方案
Try this instead:
@WebMethod(operationName = "hello")
public String hello() {
try {
return "Hello World";
} catch(Exception e) {
// Throw the fault here.
}
}
Look here for more:
不隶属于 StackOverflow