How to assign the fault field of the SOAPFaultException on the server side?
+1
A:
As far as I can tell, the only way to assign a fault field is through the constructor. So, the easiest way would be to create a new SOAPFaultException
with the fault as an argument.
R. Bemrose
2009-06-02 16:16:16
A:
define exception
public class SomeFault extends Exception
{
public SomeFault(String code)
{
}
public String getA() {...}
public void setA() {..}
public String getB() {...}
public void setB() {..}
}
and then webservice
@WebService
public class MyWS
{
public MyWS()
{
}
public Response getSomething(String id) throws SomeFault
{
throw new SomeFault(id);
}
}
Mykola Golubyev
2009-09-08 17:30:32