nicksafe
nicksafe

Reputation:

JAX-WS Exception

How to assign the fault field of the SOAPFaultException on the server side?

Upvotes: 1

Views: 1746

Answers (2)

Mykola Golubyev
Mykola Golubyev

Reputation: 59834

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);
   }
}

Upvotes: 0

Powerlord
Powerlord

Reputation: 88796

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.

Upvotes: 1

Related Questions