Monday 2 March 2009

Final architecture?

After several weeks of exploring different solutions including remoting and using a Windows Service I have settled on using a Web Service.

The service takes as input a value for Eps (in metres) and a url pointing to a WFS service.
Currently I have the web service running on one physical server and the WFS service running on another. The service saves the results in a KML file on the server, which can be accessed via the web. The clustering alogorithm may take several minutes to run (depending on the amount of source data) so the service needs to be called asynchronously.

Firstly, the server code that executes the DBSCAN algorithm has to be encoded as a sub rather than a function since it cannot return a value to the client if we are running asynchronously. The sub definition needs the following attribute set:

SoapDocumentMethod(OneWay:=True)

The timeout has to be increased in the service application, using a setting in the Web.config file:

httpruntime executiontimeout="1200"

The service can be called from a web client. A reference to the service is added to the client and, for the page that calls the service, the sync attribute needs to be set in the @Page directive:

Async="true"

The client can then call the service:

Dim ws As New WPSservice.Service
ws.DBSCANasyncAsync(Eps, Url)


Where ws is a reference to the web service and DBSCANasyncAsync is the sub in the web service.

I’ve got this working as it should. The client calls the service asynchronously and control returns to the client page straightaway whilst the service continues to run in the background. When complete it writes out a results file to the server. This is all well and good, but since the client does not wait for the service to finish, how does the client know when the job has been completed, where the results are, if there are any errors? This is the next stage, I need to setup a mechanism for polling the service for the results and reporting any errors back to the client. I need to start getting my system looking like a Web Processing Service as specified by the OGC.