Announcement Announcement Module
Collapse
No announcement yet.
JaxRpcPortProxyFactoryBean Concurrency Issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JaxRpcPortProxyFactoryBean Concurrency Issue

    I'm using the JaxRpcPortFactoryBean for calling a JAX RPC webservice. I've strayed from the basic usage scenario outlined in Chapter 17.5.2 of the Spring 1.2 Refrence Docs. I've used a Jboss specific class to create a javax.xml.rpc.Service. Using org.jboss.webservice.client.ServiceFactoryImpl package with JBoss I'm able to create a Service object:

    Code:
           ServiceFactoryImpl jbossServiceFactory = new ServiceFactoryImpl();
            service = jbossServiceFactory.createService(wsdlDocumentUrl, rpcMapping, extraWsdd, qName, portName);
    Putting that last bit of code in an InitializingBean, I easly intorduce it into the spring context.
    Then I simply wire up the resulting service bean in Spring under the name "myWebService".

    Code:
        <bean name="myWebService" class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean">
        	<property name="jaxRpcService">
        		<ref local="jbossJaxRpcService"/>
        	</property>
        	<property name="serviceInterface">
        		<value>
        		 	com.abc.MyEndpoint
        		</value>
        	</property>
        	<property name="portName">
        		<value>MyEndpointPort</value>
        	</property>
        </bean>
    The result is a fully functional web service singleton which I use in a multi- threaded servlet. The web service is simple. it exposes only one method getPasscode() which returns a simple object containing three strings.

    Code:
    <complexType name="Passcode">
    -
    	<sequence>
    <element name="current" nillable="true" type="string"/>
    <element name="next" nillable="true" type="string"/>
    <element name="tokenName" nillable="true" type="string"/>
    </sequence>
    </complexType>
    When multiple threads access the Service singleton, and call the getPasscode() method, a null object will result sometimes.

    My client setup is Spring 1.2 running in a webapp in JBoss 4.0.1sp1. The service endpoint is deployed on another JBoss 4.0.1sp1 instance with ws4ee.

  • #2
    The concurrency issue goes away if I don't use JaxRpcPortProxyFactory and communicate with the web service via a standard dynamic proxy.

    No concurrency issues arise using the javax.xml.rpc.Service object I created manually:
    Code:
            PasscodeMangerEndpoint passMgr = &#40;PasscodeMangerEndpoint&#41; service.getPort&#40;portName, PasscodeMangerEndpoint.class&#41;;
    Passcode pass = passMgr.getPasscode&#40;&#41;;
    Now each thread calls getPort() on the service object. I think the problem is a result of either the AOP layer involoved with JaxRpcPortProxyFactory or the fact that it uses the DII (Dynamic Invocation Interface) via a javax.rpc.Call object to invoke the webservice.

    Comment

    Working...
    X