Waiting for engine...
Skip to main content

Miscellaneous recipes

The following miscellaneous recipes do not fit into any obvious category.

Custom fault handling

There are a variety of ways that SOAP faults can be handled. They can cause the operation to abort, then cause the current document to fail, or they can generate an "application error". The WSExecuteOperation defers this decision to the WSConnection, where it can be easily customized.

To ensure that failures abort the current operation, do the following:

  1. Extend the WSConnection class, override the isFatalException() method, and include logic for determining whether an exception is fatal.
Code sample
@Override
public boolean isFatalException(Throwable t)
{
if(t instanceof MyAuthenticationException) {
return true;
}
return false;
}

To choose whether a SOAP fault is an application error or a failure, do the following:

  1. Extend the WSConnection class, override the isApplicationFault() method, and include logic for determining whether a fault is an application error.
Code sample
@Override
public boolean isApplicationFault(WebServiceResponse wsResponse)
{
if(MY_APPLICATION_UKNOWN_ERROR_CODE.equals(wsResponse.getFaultCode())) {
return false;
}
return true;
}
On this Page