We have a Apache CXF client generated using the wsdl2code codegen plugin.
We are also using Spring to create a bean for our client using:
<jaxws:client id="globalWeatherSoapTarget"
serviceClass="net.webservicex.GlobalWeatherSoap"
address="http://www.webservicex.net/globalweather.asmx" />
Now we want to add some requirements:
1) connection/read timeout
2) throttling (limiting the number of concurrent requests our client will
make to soap server)
For the first part we can add a http conduit like:
<http-conf:conduit name="*.http-conduit">
<http-conf:client ConnectionTimeout="5000" ReceiveTimeout="5000" />
</http-conf:conduit>
Note that is matching all clients using the * wildcard; but this is just to
make example clearer.
For the throttling part we were thinking of using a Spring
ConcurrencyThrottleInterceptor by using something like:
<jaxws:client id="globalWeatherSoapTarget"
serviceClass="net.webservicex.GlobalWeatherSoap"
address="http://www.webservicex.net/globalweather.asmx" />
<bean id="globalWeatherSoapThrottler"
class="org.springframework.aop.interceptor.ConcurrencyThrottleInterceptor">
<property name="concurrencyLimit" value="2" />
</bean>
<bean id="globalWeatherSoap"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource" ref="globalWeatherSoapTarget" />
<property name="interceptorNames" value="globalWeatherSoapThrottler" />
</bean>
but this is giving the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'globalWeatherSoap' defined in class path resource
[applicationContext.xml]: Initialization of bean failed; nested exception is
org.springframework.beans.ConversionNotSupportedException: Failed to convert
property value of type 'com.sun.proxy.$Proxy94 implementing
net.webservicex.GlobalWeatherSoap,javax.xml.ws.BindingProvider,java.io.Closeable'
to required type 'org.springframework.aop.TargetSource' for property
'targetSource'; nested exception is java.lang.IllegalStateException: Cannot
convert value of type [com.sun.proxy.$Proxy94 implementing
net.webservicex.GlobalWeatherSoap,javax.xml.ws.BindingProvider,java.io.Closeable]
to required type [org.springframework.aop.TargetSource] for property
'targetSource': no matching editors or conversion strategy found
I'm wondering if there is another / better way to implement throttling?
Regards,
Marcel
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-client-throttling-tp5732551.html
Sent from the cxf-user mailing list archive at Nabble.com.