Using WSE and WS-Addressing to do “third-party delivery” for the Grid

Third-party delivery has been a major topic of discussion in the Grid community. I have been in so many presentations where one of the justifications for new protocols/specifications/toolkits was the need to deliver the results of a database query directly to a third party and how this is not possible with current WS technologies. I can understand the requirement since there may be situations where the resulting dataset may be big and the ultimate receiver of that dataset is not the same as the original sender of the query.

I was talking with my boss Paul Watson about this and I promised to investigate my statement to him that this kind of behaviour is extremely easy to implement. So, here's the code. With only few (very few) lines, I managed to achieve "third-party delivery". Let me take you through the C# code (I have only left out the "using" statements)...

This is the simple service that will ultimately process the data (the third party). Nothing special here.

namespace uk.ac.neresc.thirdpartydelivery.thirdpartyservice

{

public class Service : SoapService

{

[SoapMethod("uri:action")]

public void Result(XmlElement data)

{

// process the received data

}

}

}

This is the simple service that will execute the query (the middle service). Nothing special here either. It looks like a normal WSE service.

namespace uk.ac.neresc.thirdpartydelivery.middleservice

{

public class Service : SoapService

{

[SoapMethod("uri:action")]

public XmlDocument Result(string query)

{

// Execute query and return results

XmlDocument doc = new XmlDocument();

doc.LoadXml("<hello>world</hello>");

return doc;

}

}

}

And now for the initiator of the request...

namespace uk.ac.neresc.thirdpartydelivery.consumer

{

class Program

{

static void Main(string[] args)

{

// Create the envelope

SoapEnvelope envelope = new SoapEnvelope();

envelope.Context.Addressing.Action = new Action("uri:action");

// Set the destination

envelope.Context.Addressing.Destination = new EndpointReference(new Uri(args[0]));

// Set the destination of the reply. This is where the interesting bit happens!!!

// Apart from this, the rest is the same as in any other case

envelope.Context.Addressing.ReplyTo = new ReplyTo(new Uri(args[1]));

// Populate the body of the message

envelope.SetBodyObject("this is a query");

// Send the message

SoapSender sender = new SoapSender();

sender.Destination = envelope.Context.Addressing.Destination;

sender.Send(envelope);

}

}

}

How easy is this?

I do hope I am not going to hear again about the difficulties of doing third-party delivery on the Grid and if somebody tells you that you need millions of lines of code and that their toolkit supports this, please refer them to this post 🙂

One response to “Using WSE and WS-Addressing to do “third-party delivery” for the Grid”

  1. Hristo Yankov

    And what would the args be? Would the endpoint and the reply to be http://something or tcp.soap … etc. ?