public class WSClientDynamicProxy extends Object implements IWSClientProxy
IWSClientProxy
interface and proxies requests for a
web service interface, providing services such as session managment via a IWSClientSession
instance,
as well as web service result caching via a IWSCacheManager
.
The web service request is handled by the underlying Glue SOAP stackModifier and Type | Field and Description |
---|---|
protected AuthCredentials |
m_authCredentials |
protected int |
m_clientSocketReadTimeout |
protected String |
m_endPointURL |
protected List<IFailedAuthCallback> |
m_failedAuthCallbacks |
protected String |
m_hostURL |
protected IWSProxyFactory |
m_proxyFactory |
protected boolean |
m_reuseSession |
protected boolean |
m_useCache |
protected Class<?> |
m_webServiceClass |
protected String |
m_wsdlURL |
static boolean |
REMOVE_WSDL_FROM_GLUE_CACHE |
Constructor and Description |
---|
WSClientDynamicProxy() |
WSClientDynamicProxy(IWSProxyFactory proxyFactory,
Class<?> clazz,
String wsdlURL,
String endPoint,
boolean useCache,
boolean reuseSession,
int clientSocketReadTimeout,
AuthCredentials authCredentials)
Primary constructor for creating a new proxy instance for a web service interface stub
NOTE: normally this constructor is not called directly, instead a new proxy is obtained via
the proxy factory
IWSProxyFactory.getProxy() |
Modifier and Type | Method and Description |
---|---|
void |
addFailedAuthCallback(IFailedAuthCallback callbackObj)
Register a
IFailedAuthCallback listener to be invoked when an authentication failure occurs
when invoking a web service |
void |
flushCache()
Flush the cache web service results cache associated with this proxy
|
AuthCredentials |
getAuthCredentials()
Get the
AuthCredentials used by this proxy to authenticate web service request. |
protected Throwable |
getBaseException(Throwable t)
helper method to unravel InvocationException and WrappedExceptions
|
protected Object |
getBinding(electric.glue.context.ProxyContext context) |
int |
getClientSocketReadTimeout()
Get the socket timeout.
|
protected Throwable |
getCompatibleException(Method method,
Throwable t)
Translate an exception into a Throwable that is explicitly declared in the the method's
throws clause, or wrapped as a RuntimeException (this avoids a UndeclaredThrowableException)
|
String |
getEndPointURL()
Get the endpoint that this web service proxy will invoke
|
List<IFailedAuthCallback> |
getFailedAuthListeners()
Get the list of all registered
IFailedAuthCallback listeners |
String |
getHostURL()
Get the host partion of the
IWSClientProxy.getEndPointURL() } |
protected Set<Method> |
getInternalMethods() |
IWSProxyFactory |
getProxyFactory()
The factory that instantiated this proxy
|
boolean |
getReuseSession()
Whether to attempt to recycle an existing
IWSClientSession when
invoking a web service |
boolean |
getUseCache()
Whether invocations will check with the CacheManager
|
Class<?> |
getWebServiceClass()
Get the portType class that this IWSClientProxy instance is proxying
|
String |
getWsdlURL()
The WSDL url for this proxy
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Invoke a web service method.
|
Object |
invokeMethod(IWSClientSession session,
Method method,
Object[] args)
Directly invoke a web service method.
|
protected boolean |
isNonRetryableException(Throwable throwable)
Determine if an exception is fatal (connection, transport, or other non-retry types of errors)
|
void |
removeFailedAuthCallback(IFailedAuthCallback callbackObj)
Remove a specific
IFailedAuthCallback object from the list of listeners |
void |
setAuthCredentials(AuthCredentials authCredentials) |
void |
setHostURL(String hostURL) |
void |
setReuseSession(boolean reuseCache)
Specify whether to attempt to recycle an existing
IWSClientSession
when invoking a web service |
void |
setUseCache(boolean useCache)
Set option for the cache manager to cache web service results
|
protected Throwable |
wrapWsClientException(Throwable throwable)
Wrap the exception if with WsClientException with additional error text (if appropriate)
|
protected IWSProxyFactory m_proxyFactory
protected Class<?> m_webServiceClass
protected String m_wsdlURL
protected String m_endPointURL
protected String m_hostURL
protected boolean m_useCache
protected boolean m_reuseSession
protected int m_clientSocketReadTimeout
protected AuthCredentials m_authCredentials
protected List<IFailedAuthCallback> m_failedAuthCallbacks
public static final boolean REMOVE_WSDL_FROM_GLUE_CACHE
public WSClientDynamicProxy(IWSProxyFactory proxyFactory, Class<?> clazz, String wsdlURL, String endPoint, boolean useCache, boolean reuseSession, int clientSocketReadTimeout, AuthCredentials authCredentials)
IWSProxyFactory.getProxy()
proxyFactory
- IWSProxyFactory
the proxy factoryclazz
- web service interface to proxywsdlURL
- URL of the web service WSDL fileendPoint
- The endpoint URL of the web serviceuseCache
- enable/disable web service result caching for this proxyreuseSession
- true to enable/disable session reuse for this proxyclientSocketReadTimeout
- the web service timeout in millisecondsauthCredentials
- AuthCredentials
to use when authenticating the web service request. If null,
the AuthCredentials
of the WSProxyFactory will be used.public WSClientDynamicProxy()
public Object invokeMethod(IWSClientSession session, Method method, Object[] args) throws Throwable
invoke()
method, which
includes authentication retries and result cachingsession
- IWSClientSession
instance to invoke the web service throughmethod
- the Method
on the web service interface to invokeargs
- the web service method arguments as an Object[]Throwable
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
proxy
- IWSClientSession
instance to invoke the web service throughmethod
- the Method
on the web service interface to invokeargs
- the web service method arguments as an Object[]Throwable
public IWSProxyFactory getProxyFactory()
IWSClientProxy
getProxyFactory
in interface IWSClientProxy
IWSProxyFactory
that created this proxy instancepublic String getEndPointURL()
IWSClientProxy
getEndPointURL
in interface IWSClientProxy
public String getHostURL()
IWSClientProxy
IWSClientProxy.getEndPointURL()
}getHostURL
in interface IWSClientProxy
public String getWsdlURL()
IWSClientProxy
getWsdlURL
in interface IWSClientProxy
public boolean getUseCache()
IWSClientProxy
getUseCache
in interface IWSClientProxy
public void setUseCache(boolean useCache)
IWSClientProxy
setUseCache
in interface IWSClientProxy
useCache
- true to enable caching, false to disable cachingpublic boolean getReuseSession()
IWSClientProxy
IWSClientSession
when
invoking a web servicegetReuseSession
in interface IWSClientProxy
public void setReuseSession(boolean reuseCache)
IWSClientProxy
IWSClientSession
when invoking a web servicesetReuseSession
in interface IWSClientProxy
reuseCache
- true to enable session reuse, false to create a new session on each service invocationpublic AuthCredentials getAuthCredentials()
IWSClientProxy
AuthCredentials
used by this proxy to authenticate web service request.
Specifying null credentials will use global credentials set on the @WSClient
instance.getAuthCredentials
in interface IWSClientProxy
AuthCredentials
for this proxypublic Class<?> getWebServiceClass()
IWSClientProxy
getWebServiceClass
in interface IWSClientProxy
public int getClientSocketReadTimeout()
IWSClientProxy
getClientSocketReadTimeout
in interface IWSClientProxy
protected Object getBinding(electric.glue.context.ProxyContext context)
public void addFailedAuthCallback(IFailedAuthCallback callbackObj)
IWSClientProxy
IFailedAuthCallback
listener to be invoked when an authentication failure occurs
when invoking a web serviceaddFailedAuthCallback
in interface IWSClientProxy
callbackObj
- - the IFailedAuthCallback
object instancepublic void removeFailedAuthCallback(IFailedAuthCallback callbackObj)
IWSClientProxy
IFailedAuthCallback
object from the list of listenersremoveFailedAuthCallback
in interface IWSClientProxy
callbackObj
- - the IFailedAuthCallback object instance to removepublic List<IFailedAuthCallback> getFailedAuthListeners()
IWSClientProxy
IFailedAuthCallback
listenersgetFailedAuthListeners
in interface IWSClientProxy
IFailedAuthCallback
instancesprotected Throwable getBaseException(Throwable t)
protected Throwable getCompatibleException(Method method, Throwable t)
method
- - the invoked methodt
- - the exception thrown by the methodpublic void flushCache()
IWSClientProxy
flushCache
in interface IWSClientProxy
protected Throwable wrapWsClientException(Throwable throwable)
throwable
- exception thrown by the web service invocationprotected boolean isNonRetryableException(Throwable throwable)
throwable
- the Exception to examinepublic void setHostURL(String hostURL)
public void setAuthCredentials(AuthCredentials authCredentials)