The Spring Framework

org.springframework.remoting.jaxws
Class JaxWsPortClientInterceptor

java.lang.Object
  extended by org.springframework.remoting.jaxws.LocalJaxWsServiceFactory
      extended by org.springframework.remoting.jaxws.JaxWsPortClientInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor, InitializingBean
Direct Known Subclasses:
JaxWsPortProxyFactoryBean

public class JaxWsPortClientInterceptor
extends LocalJaxWsServiceFactory
implements MethodInterceptor, 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).

Since:
2.5
Author:
Juergen Hoeller
See Also:
setPortName(java.lang.String), setServiceInterface(java.lang.Class), Service.getPort(javax.xml.namespace.QName, java.lang.Class), RemoteAccessException, JndiObjectFactoryBean

Constructor Summary
JaxWsPortClientInterceptor()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
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.
 Service getJaxWsService()
          Return a reference to an existing JAX-WS Service instance, if any.
 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.
 Class getServiceInterface()
          Return the interface of the service that this factory should create a proxy for.
 Object invoke(MethodInvocation invocation)
           
protected  boolean isPrepared()
          Return whether this client interceptor has already been prepared, i.e. has already looked up the JAX-WS service and port.
 void prepare()
           
 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 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.
 
Methods inherited from class org.springframework.remoting.jaxws.LocalJaxWsServiceFactory
createJaxWsService, getNamespaceUri, getQName, getServiceName, getWsdlDocumentUrl, setExecutor, setHandlerResolver, setNamespaceUri, setServiceName, setTaskExecutor, setWsdlDocumentUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxWsPortClientInterceptor

public JaxWsPortClientInterceptor()
Method Detail

setJaxWsService

public void setJaxWsService(Service jaxWsService)
Set a reference to an existing JAX-WS Service instance, for example obtained via JndiObjectFactoryBean. If not set, LocalJaxWsServiceFactory's properties have to be specified.

See Also:
LocalJaxWsServiceFactory.setWsdlDocumentUrl(java.net.URL), LocalJaxWsServiceFactory.setNamespaceUri(java.lang.String), LocalJaxWsServiceFactory.setServiceName(java.lang.String), JndiObjectFactoryBean

getJaxWsService

public Service getJaxWsService()
Return a reference to an existing JAX-WS Service instance, if any.


setPortName

public void setPortName(String portName)
Set the name of the port. Corresponds to the "wsdl:port" name.


getPortName

public String getPortName()
Return the name of the port.


setServiceInterface

public void setServiceInterface(Class serviceInterface)
Set the interface of the service that this factory should create a proxy for.


getServiceInterface

public Class getServiceInterface()
Return the interface of the service that this factory should create a proxy for.


setLookupServiceOnStartup

public void setLookupServiceOnStartup(boolean lookupServiceOnStartup)
Set whether to look up the JAX-WS service on startup.

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.


afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean

prepare

public void prepare()

isPrepared

protected boolean isPrepared()
Return whether this client interceptor has already been prepared, i.e. has already looked up the JAX-WS service and port.


getPortQName

protected final QName getPortQName()
Return the prepared QName for the port.

See Also:
setPortName(java.lang.String), LocalJaxWsServiceFactory.getQName(java.lang.String)

getPortStub

protected Object getPortStub()
Return the underlying JAX-WS port stub that this interceptor delegates to for each method invocation on the proxy.


invoke

public Object invoke(MethodInvocation invocation)
              throws Throwable
Specified by:
invoke in interface MethodInterceptor
Throws:
Throwable

doInvoke

protected Object doInvoke(MethodInvocation invocation)
                   throws Throwable
Perform a JAX-WS service invocation based on the given method invocation.

Parameters:
invocation - the AOP method invocation
Returns:
the invocation result, if any
Throws:
Throwable - in case of invocation failure
See Also:
getPortStub(), doInvoke(org.aopalliance.intercept.MethodInvocation, Object)

doInvoke

protected Object doInvoke(MethodInvocation invocation,
                          Object portStub)
                   throws Throwable
Perform a JAX-WS service invocation on the given port stub.

Parameters:
invocation - the AOP method invocation
portStub - the RMI port stub to invoke
Returns:
the invocation result, if any
Throws:
Throwable - in case of invocation failure
See Also:
getPortStub()

The Spring Framework

Copyright © 2002-2007 The Spring Framework.