I am developing a jax-ws web service proof of concept in RAD 8.0.4 and running in WebSphere 7. Our app uses Spring and Hibernate, but we're not exactly experts in either. We need to enable global transactions with our web service so it can work with the transactions of client apps. I followed the instructions I found on various websites, including IBMs, and I thought I configured everything and it doesn't work. Clearly I did something wrong.
Each transaction (client and service) work fine independently, but I forced an exception before commit in my client. This rolls back the client transaction, but not the service transaction. Furthermore, the logging on websphere (not the simply systemout one...the trace from the admin console) spits out some gobbledy-gook that implies to me that no transaction context was offered from the client.
I initially set the policies in both the services view of RAD and the admin console, but I've since read that if you set both, it doesn't work. But I have since tried just one and just the other and neither work. Here's what i did:
In my wsdl I manually added:
<wsp:Policy wsu:Id="ATPolicy"> <wsp:ExactlyOne> <wsat11:ATAssertion/> <wsat10:ATAssertion/> <!-- omitted assertions --> </wsp:ExactlyOne> </wsp:Policy>
and the wsp:PolicyReference line
<binding name="TxPortBinding" type="tns:TxDelegate"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="insertDBTrans"> <wsp:PolicyReference URI="#ATPolicy" required="true"/> <soap:operation soapAction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding>
In the admin console version, after importing the WS-Transaction policy, I navigated to Services->Service Providers->TxService, and selected the checkbox of all three level, TxService, TxPort, and insertDBTrans. Chose Attach Policy Set->WSTransaction. Click the disabled link on the service, and chose 'exported WSDL'. Ok & Save.
Then to Services->Service Clients->TxService. Check client, Attach Client Policy Set->WSTransaction. Client and provier policy chosen.
But that didn't work. So I remove them, and instead go into the services view of RAD. Right clicked on the service, manage policy sets. Put WSTransaction on the first page with Provider Sample as binding attached. It's set all the way down to the operation name - insertDbTrans.
Under the client in the services view I set the client to user provider policy, second page, chose WSTransaction for the default entry and it set to "client and provider".
We use Transactional annotations to manage our transactions via spring. The transaction manager is defined thusly: <tx:jta-transaction-manager id="transactionManager"> <property name="userTransactionName" value="java:comp/UserTransaction" /> </tx:jta-transaction-manager>
I actually tried more permutations than this. But none of them has worked.
Any ideas what I am doing wrong here?