9.17.3. 障害の処理
実装は SOAPFaultException をスローすることがあります。
public void throwSoapFaultException()
{
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault fault = factory.createFault("this is a fault string!", new QName("http://foo", "FooCode"));
fault.setFaultActor("mr.actor");
fault.addDetail().addChildElement("test");
throw new SOAPFaultException(fault);
}
または、 アプリケーション固有のユーザー例外の場合は次のようになります。
public void throwApplicationException() throws UserException
{
throw new UserException("validation", 123, "Some validation error");
}
注記
後者の場合、 JBossWS は必要な障害ラッパーの bean がデプロイの一部にない場合ランタイム時に生成します。