T
- the type of SOAP clientpublic abstract class SoapServiceClient<T> extends Object implements InvocationHandler
SoapServiceClient
class pairs together the soapClient
and
soapClientHandler
so that calls made through the
invoke(Object, Method, Object[])
method can be dispatched and
handled correctly in the SOAP layer. This class is not aware of what API it
uses and relies on the soapClientHandler
to determine how the SOAP
framework should be used.Modifier | Constructor and Description |
---|---|
protected |
SoapServiceClient(SoapClientHandlerInterface<T> soapClientHandler,
T soapClient)
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
protected RemoteCallReturn |
callSoapClient(SoapCall<T> soapCall)
Called from
invoke(Object, Method, Object[]) if the method is
intended for the SOAP client. |
protected SoapCall<T> |
createSoapCall(Method soapClientMethod,
Object[] args)
|
Object |
getSoapClient()
Returns the underlying SOAP client.
|
protected SoapClientHandlerInterface<T> |
getSoapClientHandler()
Returns the SOAP client handler.
|
protected Throwable |
handleException(Throwable e)
Handles the exception.
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Wraps the underlying SOAP RPC such that first the method, by its name,
is applied to the runtime class.
|
protected abstract void |
logSoapCall(RemoteCallReturn remoteCallReturn)
Logs a SOAP call.
|
void |
setEndpointAddress(String endpointAddress)
Sets the endpoint address of the underlying SOAP client.
|
protected abstract void |
setHeaders()
Sets the headers for the service client.
|
protected Object |
unwrapRemoteCallReturn(RemoteCallReturn remoteCallReturn)
Unwraps a SOAP remote call return such that if there was an exception, it is
thrown and if it was a successful call, the return value of the SOAP call
is returned.
|
protected SoapServiceClient(SoapClientHandlerInterface<T> soapClientHandler, T soapClient)
soapClientHandler
- the SOAP client handlersoapClient
- the SOAP clientprotected RemoteCallReturn callSoapClient(SoapCall<T> soapCall)
invoke(Object, Method, Object[])
if the method is
intended for the SOAP client. Extending classes should override this method
if they wish to wrap the call, such in cases of reauthentication or
exception handling. The actual SOAP call is synchronized on the SOAP client
so that only one request to the SOAP client can be made with without
interruption, useful for logging and exception handling.soapCall
- the call to send to the SOAP clientsoapCall
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
proxy
- the proxy class that invoke was called onmethod
- the method to apply to the proxy class or the underlying SOAP
clientargs
- the method argumentsSoapServiceClient
or a
RemoteCallReturn
object containing the result from the SOAP callThrowable
- thrown if the SOAP call passed into this method results
in an exception. The exception thrown will be not be wrapped - it will
adhere to the "throws" clause of the passed in Method
.InvocationHandler.invoke(Object, Method, Object[])
public void setEndpointAddress(String endpointAddress)
public Object getSoapClient()
protected SoapClientHandlerInterface<T> getSoapClientHandler()
protected abstract void logSoapCall(RemoteCallReturn remoteCallReturn)
remoteCallReturn
- protected abstract void setHeaders() throws ServiceException, AuthenticationException
ServiceException
- if there was a problem setting the headersAuthenticationException
- if there was a problem authenticating while
setting headersprotected Throwable handleException(Throwable e)
Default behavior is to return the exception unchanged.
e
- the exception to handleprotected Object unwrapRemoteCallReturn(RemoteCallReturn remoteCallReturn) throws Throwable
remoteCallReturn
- the RemoteCallReturn
to unwrapRemoteCallReturn.getReturnValue()
if the call was
successfulThrowable
- the exception captured in the
RemoteCallReturn.getException()
if presentCopyright © 2018. All Rights Reserved.