I've spent most of this weekend trying to work out how to best implement Web Service intermediaries in Apache Axis. Turns out this is quite hard.
While Axis is incredibly modularized, allowing you to plug-in functionality at many points, none of these are immediately useful for creating general intermediaries.
I did manage to find a way and got an ugly intermediary working for the GetQuote sample that comes with Axis. After that I began working on a more generalized framework for doing this. I have a basic framework that allows you to very simply implement a class, deploy part of the framework as an implementation of the service you want to act as an intermediary for, add a reference to your class in the WSDD entry for this service and that's it.
Your class then gets access to the request SOAPHeader and SOAPBody and the same on the way back through for the response. You can alter these as they pass.
The hardest part of this has been trying to come up with the requirements for the framework. No one appears to be doing any work with Web Services intermediaries and so I don't really know what people would want from the framework above and beyond.
One annoyance I have is that there does not appear to be an easy way to bounce between Axis' SOAPElement objects and XML DOM objects and back again. I am wondering if intermediary implementer would be okay with SOAPElements or would they rather work with pure XML DOM. I do suspect it would be the latter, as there are far more tools for assisting with that and it is the logical model of a SOAP service. However, I am concerned about the overhead in processing this.
I am a way off of releasing this, I need to add some more functionality, some examples (based on the Axis samples probably) and a really good from scratch example of a complex intermediary. I have a fairly good idea for this last part. Then more testing and some documentation.
If anyone has any ideas of features they would like to see in this let me know and I'll try and get them in, or at least architect around planned extensions.