类 JaxWsPortClientInterceptor
- java.lang.Object
- org.springframework.remoting.jaxws.LocalJaxWsServiceFactory
- org.springframework.remoting.jaxws.JaxWsPortClientInterceptor
- 所有已实现的接口:
Advice
,Interceptor
,MethodInterceptor
,Aware
,BeanClassLoaderAware
,InitializingBean
- 直接已知子类:
JaxWsPortProxyFactoryBean
public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory implements MethodInterceptor, BeanClassLoaderAware, InitializingBean
MethodInterceptor
for accessing a specific port of a JAX-WS service. Compatible with JAX-WS 2.1 and 2.2, as included in JDK 6 update 4+ and Java 7/8.Uses either
LocalJaxWsServiceFactory
's facilities underneath, or takes an explicit reference to an existing JAX-WS Service instance (e.g. obtained viaJndiObjectFactoryBean
).- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller
- 另请参阅:
setPortName(java.lang.String)
,setServiceInterface(java.lang.Class<?>)
,javax.xml.ws.Service#getPort
,RemoteAccessException
,JndiObjectFactoryBean
构造器概要
构造器 构造器 说明 JaxWsPortClientInterceptor()
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
addCustomProperty(String name, Object value)
Add a custom property to this JAX-WS BindingProvider.void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.protected void
applyDefaultsFromAnnotation(WebService ann)
Initialize this client interceptor's properties from the given WebService annotation, if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName" and "portName" haven't been set but corresponding values are declared at the annotation level of the specified service interface).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. has already looked up the JAX-WS service and port.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: for resolving WebServiceFeature class names as specified throughsetWebServiceFeatures(java.lang.Object[])
, and also for building a client proxy in theJaxWsPortProxyFactoryBean
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 viaJndiObjectFactoryBean
.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. as inner bean definitions) to apply to JAX-WS port stub creation.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.void
setWebServiceFeatures(Object[] webServiceFeatures)
已过时。as of Spring 4.0, in favor of the differentiated"serviceFeatures"
and"portFeatures"
properties从类继承的方法 org.springframework.remoting.jaxws.LocalJaxWsServiceFactory
createJaxWsService, getNamespaceUri, getQName, getServiceName, getWsdlDocumentUrl, setExecutor, setHandlerResolver, setNamespaceUri, setServiceFeatures, setServiceName, setWsdlDocumentResource, setWsdlDocumentUrl
构造器详细资料
JaxWsPortClientInterceptor
public JaxWsPortClientInterceptor()
方法详细资料
setJaxWsService
public void setJaxWsService(Service jaxWsService)
Set a reference to an existing JAX-WS Service instance, for example obtained viaJndiObjectFactoryBean
. If not set,LocalJaxWsServiceFactory
's properties have to be specified.
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.
setUsername
public void setUsername(String username)
Set the username to specify on the stub.- 另请参阅:
javax.xml.ws.BindingProvider#USERNAME_PROPERTY
getUsername
public String getUsername()
Return the username to specify on the stub.
setPassword
public void setPassword(String password)
Set the password to specify on the stub.- 另请参阅:
javax.xml.ws.BindingProvider#PASSWORD_PROPERTY
getPassword
public String getPassword()
Return the password to specify on the stub.
setEndpointAddress
public void setEndpointAddress(String endpointAddress)
Set the endpoint address to specify on the stub.- 另请参阅:
javax.xml.ws.BindingProvider#ENDPOINT_ADDRESS_PROPERTY
getEndpointAddress
public String getEndpointAddress()
Return the endpoint address to specify on the stub.
setMaintainSession
public void setMaintainSession(boolean maintainSession)
Set the "session.maintain" flag to specify on the stub.- 另请参阅:
javax.xml.ws.BindingProvider#SESSION_MAINTAIN_PROPERTY
isMaintainSession
public boolean isMaintainSession()
Return the "session.maintain" flag to specify on the stub.
setUseSoapAction
public void setUseSoapAction(boolean useSoapAction)
Set the "soapaction.use" flag to specify on the stub.- 另请参阅:
javax.xml.ws.BindingProvider#SOAPACTION_USE_PROPERTY
isUseSoapAction
public boolean isUseSoapAction()
Return the "soapaction.use" flag to specify on the stub.
setSoapActionUri
public void setSoapActionUri(String soapActionUri)
Set the SOAP action URI to specify on the stub.- 另请参阅:
javax.xml.ws.BindingProvider#SOAPACTION_URI_PROPERTY
getSoapActionUri
public String getSoapActionUri()
Return the SOAP action URI to specify on the stub.
setCustomProperties
public void setCustomProperties(Map<String,Object> customProperties)
Set custom properties to be set on the stub.Can be populated with a String "value" (parsed via PropertiesEditor) or a "props" element in XML bean definitions.
- 另请参阅:
javax.xml.ws.BindingProvider#getRequestContext()
getCustomProperties
public 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.Useful for specifying entries directly, for example via "customProperties[myKey]". This is particularly useful for adding or overriding entries in child bean definitions.
addCustomProperty
public void addCustomProperty(String name, Object value)
Add a custom property to this JAX-WS BindingProvider.- 参数:
name
- the name of the attribute to exposevalue
- the attribute value to expose- 另请参阅:
javax.xml.ws.BindingProvider#getRequestContext()
setPortFeatures
public void setPortFeatures(WebServiceFeature... features)
Specify WebServiceFeature objects (e.g. as inner bean definitions) to apply to JAX-WS port stub creation.- 从以下版本开始:
- 4.0
- 另请参阅:
Service#getPort(Class, javax.xml.ws.WebServiceFeature...)
,LocalJaxWsServiceFactory.setServiceFeatures(WebServiceFeature...)
setWebServiceFeatures
@Deprecated public void setWebServiceFeatures(Object[] webServiceFeatures)
已过时。as of Spring 4.0, in favor of the differentiated"serviceFeatures"
and"portFeatures"
propertiesSpecify WebServiceFeature specifications for the JAX-WS port stub: in the form of actualjavax.xml.ws.WebServiceFeature
objects, WebServiceFeature Class references, or WebServiceFeature class names.As of Spring 4.0, this is effectively just an alternative way of specifying
"portFeatures"
. Do not specify both properties at the same time; prefer "portFeatures" moving forward.
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.
setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)
Set the bean ClassLoader to use for this interceptor: for resolving WebServiceFeature class names as specified throughsetWebServiceFeatures(java.lang.Object[])
, and also for building a client proxy in theJaxWsPortProxyFactoryBean
subclass.- 指定者:
setBeanClassLoader
在接口中BeanClassLoaderAware
- 参数:
classLoader
- the owning class loader; may benull
in which case a defaultClassLoader
must be used, for example theClassLoader
obtained viaClassUtils.getDefaultClassLoader()
getBeanClassLoader
protected ClassLoader getBeanClassLoader()
Return the bean ClassLoader to use for this interceptor.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,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
在接口中InitializingBean
prepare
public void prepare()
Initialize the JAX-WS port for this interceptor.
applyDefaultsFromAnnotation
protected void applyDefaultsFromAnnotation(WebService ann)
Initialize this client interceptor's properties from the given WebService annotation, if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName" and "portName" haven't been set but corresponding values are declared at the annotation level of the specified service interface).- 参数:
ann
- the WebService annotation found on the specified service interface
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.
getPortStub
protected Object getPortStub(Service service, QName portQName)
Obtain the port stub from the given JAX-WS Service.- 参数:
service
- the Service object to obtain the port fromportQName
- the name of the desired port, if specified- 返回:
- the corresponding port object as returned from
Service.getPort(...)
preparePortStub
protected void preparePortStub(Object stub)
Prepare the given JAX-WS port stub, applying properties to it. Called byprepare()
.- 参数:
stub
- the current JAX-WS port stub- 另请参阅:
setUsername(java.lang.String)
,setPassword(java.lang.String)
,setEndpointAddress(java.lang.String)
,setMaintainSession(boolean)
,setCustomProperties(java.util.Map<java.lang.String, java.lang.Object>)
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
从接口复制的说明:MethodInterceptor
Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invokeJoinpoint.proceed()
.- 指定者:
invoke
在接口中MethodInterceptor
- 参数:
invocation
- the method invocation joinpoint- 返回:
- the result of the call to
Joinpoint.proceed()
; might be intercepted by the interceptor - 抛出:
Throwable
- if the interceptors or the target object throws an exception
doInvoke
protected Object doInvoke(MethodInvocation invocation) throws Throwable
Perform a JAX-WS service invocation based on the given method invocation.- 参数:
invocation
- the AOP method invocation- 返回:
- the invocation result, if any
- 抛出:
Throwable
- in case of invocation failure- 另请参阅:
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.- 参数:
invocation
- the AOP method invocationportStub
- the RMI port stub to invoke- 返回:
- the invocation result, if any
- 抛出:
Throwable
- in case of invocation failure- 另请参阅:
getPortStub()