How to assign the fault field of the SOAPFaultException on the server side?
nicksafe
问问题
1700 次
2 回答
1
据我所知,分配故障字段的唯一方法是通过构造函数。因此,最简单的方法是创建一个SOAPFaultException
以故障为参数的新方法。
于 2009-06-02T16:16:16.373 回答
0
定义异常
public class SomeFault extends Exception
{
public SomeFault(String code)
{
}
public String getA() {...}
public void setA() {..}
public String getB() {...}
public void setB() {..}
}
然后是网络服务
@WebService
public class MyWS
{
public MyWS()
{
}
public Response getSomething(String id) throws SomeFault
{
throw new SomeFault(id);
}
}
于 2009-09-08T17:30:32.943 回答