public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory implements MethodInterceptor, BeanClassLoaderAware, InitializingBean
MethodInterceptor
for accessing a
specific port of a JAX-WS service.
Uses either LocalJaxWsServiceFactory
's facilities underneath,
or takes an explicit reference to an existing JAX-WS Service instance
(e.g. obtained via JndiObjectFactoryBean
).
setPortName(java.lang.String)
,
setServiceInterface(java.lang.Class<?>)
,
Service.getPort(javax.xml.namespace.QName, java.lang.Class<T>)
,
RemoteAccessException
,
JndiObjectFactoryBean
Constructor and Description |
---|
JaxWsPortClientInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
addCustomProperty(String name,
Object value)
Add a custom property to this JAX-WS BindingProvider.
|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , ApplicationContextAware etc. |
protected void |
applyDefaultsFromAnnotation(WebService ann)
Initialize this client interceptor's properties from the given WebService annotation,
if necessary and possible (i.e.
|
protected Object |
doInvoke(MethodInvocation invocation)
Perform a JAX-WS service invocation based on the given method invocation.
|
protected Object |
doInvoke(MethodInvocation invocation,
Object portStub)
Perform a JAX-WS service invocation on the given port stub.
|
protected ClassLoader |
getBeanClassLoader()
Return the bean ClassLoader to use for this interceptor.
|
Map<String,Object> |
getCustomProperties()
Allow Map access to the custom properties to be set on the stub,
with the option to add or override specific entries.
|
String |
getEndpointAddress()
Return the endpoint address to specify on the stub.
|
Service |
getJaxWsService()
Return a reference to an existing JAX-WS Service instance, if any.
|
String |
getPassword()
Return the password to specify on the stub.
|
String |
getPortName()
Return the name of the port.
|
protected QName |
getPortQName()
Return the prepared QName for the port.
|
protected Object |
getPortStub()
Return the underlying JAX-WS port stub that this interceptor delegates to
for each method invocation on the proxy.
|
protected Object |
getPortStub(Service service,
QName portQName)
Obtain the port stub from the given JAX-WS Service.
|
Class<?> |
getServiceInterface()
Return the interface of the service that this factory should create a proxy for.
|
String |
getSoapActionUri()
Return the SOAP action URI to specify on the stub.
|
String |
getUsername()
Return the username to specify on the stub.
|
Object |
invoke(MethodInvocation invocation)
Implement this method to perform extra treatments before and
after the invocation.
|
boolean |
isMaintainSession()
Return the "session.maintain" flag to specify on the stub.
|
protected boolean |
isPrepared()
Return whether this client interceptor has already been prepared,
i.e.
|
boolean |
isUseSoapAction()
Return the "soapaction.use" flag to specify on the stub.
|
void |
prepare()
Initialize the JAX-WS port for this interceptor.
|
protected void |
preparePortStub(Object stub)
Prepare the given JAX-WS port stub, applying properties to it.
|
void |
setBeanClassLoader(ClassLoader classLoader)
Set the bean ClassLoader to use for this interceptor: primarily for
building a client proxy in the
JaxWsPortProxyFactoryBean subclass. |
void |
setCustomProperties(Map<String,Object> customProperties)
Set custom properties to be set on the stub.
|
void |
setEndpointAddress(String endpointAddress)
Set the endpoint address to specify on the stub.
|
void |
setJaxWsService(Service jaxWsService)
Set a reference to an existing JAX-WS Service instance,
for example obtained via
JndiObjectFactoryBean . |
void |
setLookupServiceOnStartup(boolean lookupServiceOnStartup)
Set whether to look up the JAX-WS service on startup.
|
void |
setMaintainSession(boolean maintainSession)
Set the "session.maintain" flag to specify on the stub.
|
void |
setPassword(String password)
Set the password to specify on the stub.
|
void |
setPortFeatures(WebServiceFeature... features)
Specify WebServiceFeature objects (e.g.
|
void |
setPortName(String portName)
Set the name of the port.
|
void |
setServiceInterface(Class<?> serviceInterface)
Set the interface of the service that this factory should create a proxy for.
|
void |
setSoapActionUri(String soapActionUri)
Set the SOAP action URI to specify on the stub.
|
void |
setUsername(String username)
Set the username to specify on the stub.
|
void |
setUseSoapAction(boolean useSoapAction)
Set the "soapaction.use" flag to specify on the stub.
|
createJaxWsService, getNamespaceUri, getQName, getServiceName, getWsdlDocumentUrl, setExecutor, setHandlerResolver, setNamespaceUri, setServiceFeatures, setServiceName, setWsdlDocumentResource, setWsdlDocumentUrl
public void setJaxWsService(@Nullable Service jaxWsService)
JndiObjectFactoryBean
.
If not set, LocalJaxWsServiceFactory
's properties have to be specified.@Nullable public Service getJaxWsService()
public void setPortName(@Nullable String portName)
public void setUsername(@Nullable String username)
BindingProvider.USERNAME_PROPERTY
public void setPassword(@Nullable String password)
BindingProvider.PASSWORD_PROPERTY
public void setEndpointAddress(@Nullable String endpointAddress)
@Nullable public String getEndpointAddress()
public void setMaintainSession(boolean maintainSession)
public boolean isMaintainSession()
public void setUseSoapAction(boolean useSoapAction)
BindingProvider.SOAPACTION_USE_PROPERTY
public boolean isUseSoapAction()
public void setSoapActionUri(@Nullable String soapActionUri)
BindingProvider.SOAPACTION_URI_PROPERTY
@Nullable public String getSoapActionUri()
public void setCustomProperties(Map<String,Object> customProperties)
Can be populated with a String "value" (parsed via PropertiesEditor) or a "props" element in XML bean definitions.
BindingProvider.getRequestContext()
public Map<String,Object> getCustomProperties()
Useful for specifying entries directly, for example via "customProperties[myKey]". This is particularly useful for adding or overriding entries in child bean definitions.
public void addCustomProperty(String name, Object value)
name
- the name of the attribute to exposevalue
- the attribute value to exposeBindingProvider.getRequestContext()
public void setPortFeatures(WebServiceFeature... features)
public void setServiceInterface(@Nullable Class<?> serviceInterface)
@Nullable public Class<?> getServiceInterface()
public void setLookupServiceOnStartup(boolean lookupServiceOnStartup)
Default is "true". Turn this flag off to allow for late start of the target server. In this case, the JAX-WS service will be lazily fetched on first access.
public void setBeanClassLoader(@Nullable ClassLoader classLoader)
JaxWsPortProxyFactoryBean
subclass.setBeanClassLoader
in interface BeanClassLoaderAware
classLoader
- the owning class loader@Nullable protected ClassLoader getBeanClassLoader()
public void afterPropertiesSet()
InitializingBean
BeanFactory
after it has set all bean properties
and satisfied BeanFactoryAware
, ApplicationContextAware
etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
afterPropertiesSet
in interface InitializingBean
public void prepare()
protected void applyDefaultsFromAnnotation(WebService ann)
ann
- the WebService annotation found on the specified service interfaceprotected boolean isPrepared()
protected Object getPortStub(Service service, @Nullable QName portQName)
service
- the Service object to obtain the port fromportQName
- the name of the desired port, if specifiedService.getPort(...)
protected void preparePortStub(Object stub)
prepare()
.stub
- the current JAX-WS port stubsetUsername(java.lang.String)
,
setPassword(java.lang.String)
,
setEndpointAddress(java.lang.String)
,
setMaintainSession(boolean)
,
setCustomProperties(java.util.Map<java.lang.String, java.lang.Object>)
@Nullable protected Object getPortStub()
@Nullable public Object invoke(MethodInvocation invocation) throws Throwable
MethodInterceptor
Joinpoint.proceed()
.invoke
in interface MethodInterceptor
invocation
- the method invocation joinpointJoinpoint.proceed()
;
might be intercepted by the interceptorThrowable
- if the interceptors or the target object
throws an exception@Nullable protected Object doInvoke(MethodInvocation invocation) throws Throwable
invocation
- the AOP method invocationThrowable
- in case of invocation failuregetPortStub()
,
doInvoke(org.aopalliance.intercept.MethodInvocation, Object)
@Nullable protected Object doInvoke(MethodInvocation invocation, @Nullable Object portStub) throws Throwable
invocation
- the AOP method invocationportStub
- the RMI port stub to invokeThrowable
- in case of invocation failuregetPortStub()