简体   繁体   中英

Concurrent Web Service Requests using JAX-WS

I need to design a solution for my problem. So, Please help me.

My Problem :

We have one Web Project. There we are using four tables called A, B, C, D. For each table, we had created one front-end page and we provided a button for save the record to respective tables. Now we need to share this each record data to another application using Web-Service integration. I have the knowledge on JAX-WS web service.

We Identified the required fields and we created only one common WSDL for all four tables. When the user will try to save the record, at the time only i need to raise the web service call.(Event Base) Here we are fallowing the Synchronous web service. Ie for every request system will wait for response from other end.

Suppose, first i am trying to save the record in table A. so, i filled all required fields in form A, and i am trying to hit the save button. record saved in database as well as raised a web service request to other end, sent an record to server and waiting for response..... If in this mean while if again i am trying to send another record for same form A (or) new record for form B.

Then how to handle this kind of scenario, because already a thread was busy with server for their response. So, how to raise an multiple request concurrently as we as in synchronously.

Please suggest me with the possible solutions that i can apply. An suggestion will be great helpful for me.

(Sorry for my bad English)

Looking at your scenario i see that you have something like:

Database -> Web JAX-WS Server -> Multiple JAX-WS Clients

When you call from the client to the WS Server a new thread is created to handle the request and process the response for every client. Web servers are "multithread" and support multiple clients calling at same time. Your problem probably is after the WS service.

If with your WS you are trying to read the same table with two clients there is no problem but if one client tries to save when other reads or two or more clients are updating the table a Transaction lock is probably the problem.

Depending on the database configuration you should need to configure your transaction isolation options and handle carfully your database connections opening and closing your transactions only when is absolutly required

For example if you are using MySQL with InnDB ( http://dev.mysql.com/doc/refman/5.0/es/innodb-transaction-isolation.html ) and your Transaction isolation is "SERIALIZABLE" when you perform a query al table is locked until transaction ends and any other client is waiting until the transaction is released or a timeout is raised.

But if you hace "REPEATABLE READ" only the records readed by one transaction are locked to other transactions. This can be "good" in some environments but two SQL sentences that aplies to the same row probably cause a dead lock. * Default for MySQL InnDB

Also you should use READ COMMITED or READ UNCOMMITED to allow read all table and modify different records. Also to handle the same record with minimal problems is always recommended: "Open your transactions only the minimal required time"


Check your WS client for singleton patterns that destroys first request when you create a second request. Also check if you are using an WS with state, preserving session or another server side objects in a user session that are the same for different requests..

Related to Stateles:

Is it possible to use @WebService, @Stateless and @Singleton altogether in one EJB 3 bean?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM