Announcement Announcement Module
Collapse
No announcement yet.
WS-AT and Spring WSDL web services Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WS-AT and Spring WSDL web services

    Hi,

    I am a neophyte trying to learn how to do the following: I need to create web services (and clients) that participate in a single WS-AT transaction together. I want the web service to have hibernate services injected, and the client to have hibernate service and web service clients injected, and the client & service share in a single transaction that, if one part fails, they all rollback together.

    I have found a terrible lack of good tutorials on WS-AT stuff. The only one I've found seems oriented towards a non-spring managed environment. (http://www.redbooks.ibm.com/redbooks/pdfs/sg247758.pdf section 8.3). Is there a good resource somewhere to learn this? How would you recommend I proceed?

  • #2
    *bump* Please, I am still in need of help here.

    I have a web service that I create using the RAD wizard, then I use SpringBeanAutowiringSupport to inject hibernate stuff on the server side, and I write my junit client and use AbstractDependencyInjectionSpringContextTests to inject hibernate stuff on the client. This all works.

    I also have the redbook stuff above that seems to tell me how I would get the WSDL to participate in the transaction, but I seem to need XA datasources AND to have some kind of transaction manager like atomikos in play. Is that true? Or does the regular Hibernate/Spring transaction manager do the job? Either way, I can't get this part to work. Very frustrating.

    My app-config includes stuff like the following.
    <bean id="enoteDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean">
    <property name="uniqueResourceName" value="devl"></property>
    <property name="xaDataSourceClassName" value="com.ibm.db2.jcc.DB2XADataSource" />
    <property name="xaProperties">
    <props>
    <prop key="URL">jdbc:db2://dev-catsdb-01:60004/devl:driverType=4;currentSchema=K702PRDR;</prop>
    <prop key="user">...</prop>
    <prop key="password">...</prop>
    <prop key="portNumber">60004</prop>
    <prop key="driverType">4</prop>
    <prop key="currentSchema">K702PRDR</prop>
    <prop key="databaseName">devl</prop>
    </props>
    </property>
    <property name="poolSize" value="10"></property>
    </bean>

    <bean id="wsdlSessionFactory" class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="enoteDataSource" />
    <property name="packagesToScan" value="com.wsdl" />
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.DB2D ialect</prop>
    <prop key="hibernate.connection.driver_class">com.ibm.db 2.jcc.DB2Driver</prop>
    <prop key="hibernate.bytecode.provider">javassist</prop>
    <prop key="hibernate.show_sql">false</prop>
    <prop key="hibernate.cache.use_second_level_cache">false </prop>
    <prop key="hibernate.default_schema">k702prdr</prop>
    </props>
    </property>
    <property name="annotatedClasses">
    <list>
    <value>com.wsdl.db.DBTrans</value>
    <value>com.wsdl.db.UsrTrans</value>
    </list>
    </property>
    </bean>
    <!-- END Data sources -->

    <!-- BEGIN Properties -->
    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location">
    <value>file:C:\views\DevPrototypeInt\WSDLProject\W ebContent\WEB-INF\enote.properties</value>
    </property>
    </bean>
    <utilroperties id="sysProperties" location="file:C:\views\DevPrototypeInt\WSDLProjec t\WebContent\WEB-INF\enote.properties" />
    <utilroperties id="appProperties">
    <prop key="appName">eNote Application</prop>
    </utilroperties>
    <!-- END Properties -->

    <!-- BEGIN Hibernate config and dependencies -->
    <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />

    <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionMana ger" init-method="init" destroy-method="close">
    <property name="forceShutdown"><value>true</value></property>
    </bean>

    <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" >
    <property name="transactionTimeout"><value>300</value></property>
    </bean>
    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager">
    <property name="transactionManager"><ref bean="atomikosTransactionManager" /></property>
    <property name="userTransaction"><ref bean="atomikosUserTransaction" /></property>
    </bean>
    And this consistently throws exceptions saying that the required property databaseName is not set on the connection...yet it clearly is. I've tried several other iterations on this and none have worked. If I am doing it all wrong, can someone point me to a resource that shows the "right way" to use Spring, Hibernate together so that someone running a local hibernate transaction can call a WSDL web service and use WS-AT to allow the backend service to also participate in that transaction?

    Comment

    Working...
    X