general exception
general exception

Reputation: 4342

ASP.NET WebService call queuing

I have an ASP.NET Webform which currently calls a Java WebService. The ASP.NET Webform is created/maintained inhouse, whereas the Java WS is a package solution where we only have a WS interface to the application.

The problem is, that the Java WS is sometimes slow to respond due to system load etc. and there is nothing I can do about this. So currently at the moment there is a long delay on the ASP.NET Webform sometimes if the Java-WS is slow to respond, sometimes causing ASP.NET to reach its timeout value and throw the connection.

I need to ensure data connectivity between these two applications, which I can do by increasing the timeout value, but I cannot have the ASP.NET form wait longer than a couple of seconds.

This is where the idea of a queuing system comes into place.

My idea is, to have the ASP.NET form build the soap request and then queue it in a local queue, where then a Daemon runs and fires off the requests at the Java-WS.

Before I start building something from scratch I need a couple of pointers.

  1. Is my solution viable ?
  2. Are there any libraries etc already out there that I can achieve this functionality with ?
  3. Is there a better way of achieving what i am looking for ?

Upvotes: 1

Views: 1789

Answers (3)

John Saunders
John Saunders

Reputation: 161821

You have two separate problems:

  1. Your web form needs to learn to send a request to a service and later poll to get the results of that service. You can do this by writing a simple intermediate service (in WCF, please) which would have two operations: one to call the Java service asynchronously, and the other to find out whether the async call has completed, and return the results if it has.
  2. You may need to persistently queue up requests to the Java service. The easiest way to do this, if performance isn't a top concern (and it seems not to be), is to break the intermediate service in #1 into two: one half calls the other half using a WCF MSMQ binding. This will transparently use MSMQ as a transport, causing queued requests to stay in the queue until they are pulled out by the second half. The second half would be written as a Windows service so that it comes up on system boot and starts emptying the queue.

Upvotes: 2

JotaBe
JotaBe

Reputation: 39055

You can create a WindowsService hosting a WCF service.

Your web app can them call the WCF methods of your Windows Service.

Your windows service can call the java web service methods asynchronously, using the begin/End pattern

Your windows service can even store the answers of the java web service, and expose them through another WCF methods. For example you could have this methods in your WCF service:

1) a method that allows to call inderectly a java web service and returnd an identifier for this call

2) another method that returns the java web service call result by presenting the identifier of the call

You can even use AJAX to call the WCF methods of your Windows Service.

Upvotes: 3

Massimiliano Peluso
Massimiliano Peluso

Reputation: 26737

you could use MSMQ for queuing up the requests from you client. Bear in mind that MSMQ doesn't handle anything for you - it's just a transport.

All it does is take MSMQ messages and deliver them to MSMQ queues.

The creation of the original messages and the processing of the delivered messages is all handled in your own code on the sending and receiving machines: the destination machine would have to have MSMQ installed plus a custom service running to pick them up and process them

Anyway there is a librays for interop with MSQM using JAVA : http://msmqjava.codeplex.com/

Another way could be you can create a queue on one of your windows box and then create a service that pick up the messages form the Queue and foreward them to the Java service

Upvotes: 2

Related Questions