My Photo
Name:
Location: Bloomington, Indiana, United States

Wednesday, January 17, 2007

How to accommodate an Out-Only MEP service in Axis2

I have been queried quite a few times by Axis2 users about writing Out-Only MEPed services with Axis2 wsdl2java compiler, so thought of writing this down for future use.

First of all Axis2 does not have first class support for Out-Only MEP, as at now. Main reason being that this MEP is not widely used. Further there is a technique that is stated below that could change Out-Only MEP paradigm in to some kind of isomorphism to IN-Only MEP by switching client and the server.
In technical point of view there are other concerns such as, if a Out-Only is sitting inside Tomcat what would trigger it to send out its message? This trigger cannot be an incoming SOAP message to that service, because if it is then the MEP of the service would change to IN-OUT. So we need some trigger interface to the service implementation to tell it 'ok service now its time to send out your message'. Say we do all that what would be the gain, I would say nothing much. Even though the service reside inside Tomcat it will not gain much from Tomcat scalability because when it is sending out its message it will use commons http to initiate its communication, i.e. it would not use Tomcat's(actually jetty's) features. So might as well keep it outside Tomcat and following is the way to do it.


Method
Say you have the out-only operation named op1( which does not have a input message reference)

WSDL operation would look something like the following:






We always refer to the MEP with respec
t to the server's message exchange.

Consider a In-Only MEP, its operation would look like the following.





Now compare the service of Out-Only MEP against the client of the In-Only MEP. They are semantically the same, both
send out only one message.

So if you have a WSDL with Out-Only MEP like the following.






Change it to (i.e. change the output message reference to an input message reference)






Now above is a very familiar MEP for Axis2, In-Only MEP. Now using this changed wsdl, instead of code generating for server we code generate for client using wsdl2java compiler.

Now you will get a client that would send out messages when you call/trigger it to the endpoint you define. Functionality sound familiar?? Its same as what Out-Only service would do.

The only flaw that I can think of is that there will be no endpoint where you could run a ?wsdl query and get the WSDL. That would something that you would achieve had this service been deployed inside Tomcat. Its a compromise.

0 Comments:

Post a Comment

<< Home