1

We have never used the WS-Transaction policy before in Websphere, therefore I am in the process of developing a prototype to evaluate it.

This is how the prototype is structured. I have developed two applications, APP_A and APP_B using eclipse.

  • APP_A contains two JAXWS web services, service_X and service_Y
  • service_X accepts minimal data, writes it to a table on an oracle database and then returns the primary key in the response
  • service_y accepts the primary key returned from service_X and some other minimal data, writes it to a different table on the same oracle database and then returns the primary key in the response
  • APP_B contains one JAXWS web service, service_Z
  • service_z accepts all data required to post a request to service_x and service_y, and does so returning both primary keys returned from service_x and service_y in its response

both APP_A and APP_B are deployed to Websphere 8.5.5.9, and have been tested successfully.

Then via the Websphere admin console, I created a new application policy set and included the ws-transaction policy. I then attached this policy to the provider policies within APP_A and the client policies within APP_B, and then restarted Websphere.

I then submitted a request to APP_B, from the log files I can see that the request is being successfully received by service_z in APP_B, but when it attempts to post a request to service_x in APP_A the following error is reported:

[02/06/16 11:53:43:040 BST] 00000076 AxisEngine    E org.apache.axis2.engine.AxisEngine receive WTRN0127E: Operation blocked by policy type configuration.

I have followed several online articles from IBM developer works that all imply everything should work by just applying the policies via the admin console, but unfortunately I still encounter this error.

I suspect that I may need to include something within the header of the service call, but I am not sure what this is or how to achieve it.

One of the articles suggested using the IBM Rational Application Developer tool, exporting the policies from the admin console and then importing them into the project prior to deployment. I tried this using IBM RAD 9.11 as per the instructions, but it still does not resolve the issues.

Any help/advice would be appreciated, thanks in advance for your help.

David
  • 11
  • 1
  • Maybe it would help to link to the specific article(s) containing the set of instructions you tried. E.g. what type of bindings, etc. Seems like whatever header should have been passed would come from attaching the policy set to the client side. – Scott Kurz Jun 06 '16 at 14:13
  • These are the links to the articles/support pages that I have tried [https://www.ibm.com/support/knowledgecenter/en/was_beta/com.ibm.websphere.base.doc/ae/twbs_wstx_config_client.html?view=embed](https://www.ibm.com/support/knowledgecenter/en/was_beta/com.ibm.websphere.base.doc/ae/twbs_wstx_config_client.html?view=embed) [https://www.ibm.com/support/knowledgecenter/en/was_beta/com.ibm.websphere.base.doc/ae/twbs_wstx_config_ser.html?view=embed](https://www.ibm.com/support/knowledgecenter/en/was_beta/com.ibm.websphere.base.doc/ae/twbs_wstx_config_ser.html?view=embed) – David Jun 07 '16 at 08:55
  • [https://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/twbs_wsspsptran.html](https://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/twbs_wsspsptran.html) – David Jun 07 '16 at 09:00

2 Answers2

0

I think that you have specified mandatory WS-AT Policy but there is no JTA transaction on the thread. Presumably you want to start a transaction in APP_B and use WS-AT to propagate that transaction on the requests to service_X and service_Y so that all work is coordinated under a single transaction. If service_Z is a POJO you can use UserTransaction to begin/commit the transaction or you could just use a single request to an EJB with CMT to wrap the multiple web service requests to the backend services. NOTE the PolicySet won't automatically start the JTA transaction for you - the easiest way to think of WS-AT is that it is for webservices what JTS/OTS is for CORBA/IIOP (ie EJB requests) - so transaction lifecycle is via JTA in a J2EE app server and transaction propagation and 2PC coordination is via WS-AT for webservices. The way to think about the WS-AT PolicySet config is that on the requester-side it determines whether an existing JTA transaction on the thread is propagated on the request (and whether it should police that a transaction must be present) - on the provider-side it determines whether it should import and execute under a WS-AT transaction context if present and whether it is valid to invoke the sevice if no tran context is present. Hope this helps.

dan
  • 1
  • 1
  • Hi Dan, thanks for your assistance so far. I will add some comments below to in response to the questions you have asked. – David Jun 09 '16 at 13:57
  • Yes this is correct, the ws-transaction policy is set to mandatory – David Jun 09 '16 at 13:58
  • APP_A contains service_X and service_Y, both these services work independently of each other obtaining a transaction from WebSphereUowTransactionManager. APP_B is essentially a POJO with annotations making it a JAXWS service that invokes both service_X and service_Y. – David Jun 09 '16 at 13:58
  • I don't want to use EJBs. When service_Z is invoked it builds a request and submits to service_X, then builds a request and submits it service_Y. At the moment it does not create a transaction itself, from reading the articles I presumed that websphere would create and manage the transaction after applying the policy set to it via the admin console. Do I need to amend APP_B so it explicitly create a transaction in order to make it work? – David Jun 09 '16 at 13:59
  • Not sure if you are referring to the spring class WebSphereUowTransactionManager or WebSphere's UOWManager. If you want a single transaction that all the web services execute under you'll need to start that in service_Z - since we seem to be talking POJOs/mock servlets then in standard J2EE you'd just lookup the UserTransaction interface in jndi and call begin/commit (if you're using Spring then their interfaces will do the equivalent thing under the covers - within the app server it's simply a JTA transaction associated with the current thread that matters). – dan Jun 09 '16 at 14:53
0

Not sure if you are referring to the spring class WebSphereUowTransactionManager or WebSphere's UOWManager. If you want a single transaction that all the web services execute under you'll need to start that in service_Z - since we seem to be talking POJOs/mock servlets then in standard J2EE you'd just lookup the UserTransaction interface in jndi and call begin/commit (if you're using Spring then their interfaces will do the equivalent thing under the covers - within the app server it's simply a JTA transaction associated with the current thread that matters). With the PolicySets configured for mandatory WS-AT that transaction will be propagated on the JAX-WS requests and the target services will execute under that transaction so you don't need (or want) any explicit interaction with the JTA transaction manager (vanilla JTA or Spring) in those services.
On the other hand if you're just hoping that the PolicySet config will create separate transactions in service_X and service_Y ie like having Required/RequiresNew for CMT EJBs so you don't need explicit code to scope the transactions then I'm afraid there isn't a WS-AT policy set equivalent. It's basically JTA for transaction scoping and WS-AT for propagation/2PC with policyset config allowing some configurability over the propagation.

dan
  • 1
  • 1
  • This is the transaction manager that service_X and service_Y are using within APP_A is org.springframework.transaction.jta.WebSphereUowTransactionManager – David Jun 10 '16 at 08:13
  • I will try amending APP_B so that when service_Z is invoked it explicitly creates a UserTransaction, calls begin, then makes a call to service_X and service_Y and finally calls commit. I'll let you know what happens. – David Jun 10 '16 at 08:15