As we are just starting on a project where we need to provide access to
our Cocoon based solution via a web service centric approach I have been
musing around about the best way to achieve this.

Now to start with Cocoon is really ideal for web services. Basically it
already is capable of providing a web service platform. After all you
can communicate with it using HTTP and XML - so it already caters for
two of the requirements. And Cocoon allows you to define "services"
flexibly by configuring components into pipelines as you need them.

The ability to actually use Cocoon as an XML application platform - as
opposed to (just) an XML publishing platform will increase as more and
more components are developed. 

However it has one major drawback (in the world of web services): 

It does not provide a way of describing the available functions 
(read: pipelines) in a standardized manner (read: WSDL).

But let's look at this step by step.

Cocoon as web service client

The client side (i.e. integrating services into a Cocoon based solution)
is pretty easy. One way is to write a custom transformer dependent on
the spec of the service (or using the WSDL). Of course an ideal solution
would allow me to generate a transformer using the WSDL automatically
(hint). There are also several ways of doing this. One way is to use
something like WSDL2Java from Axis and then perform a further step that
generates a transformer from the classes WSDL2Java spits out. Another
way would be to hook directly into the flow that emits the Java code in
Axis.

Another way of writing the client side is to use XSP and that has been
discussed before so I'll leave it at that.

Cocoon as web service server

Ok, this is where it gets more interesting. Here is basically what _we_
need:

Publish a pipeline (set of pipelines) as a web service accessible via
SOAP and providing a self-description in WSDL.

Apart from the last part (which I really think is just as important as
the first - if we think Cocoon can become a platform for WS) there are
several approaches that would probably work:

* Use XSL in a pipeline that interprets the SOAP request and then passes
off to the appropriate pipeline

* Use the Kinga/HP approach of the Adapter/Dispatcher model with
additional SOAP stuff

* Integrate Axis

Personally I think we should be looking at working with the Axis project
and integrating it into Cocoon. Here are my reasons:

* They are hard at work on the interop side of web services  
* The architecture is flexible and uses SAX 
* The architecture allows you to hook in nearly everywhere (handlers, pivots,...) 
* You get tools for free 
* It's Apache :-)

Now, I do not (yet?) understand enough about the current Axis code and I
am now quite a bit removed from actually implementing (as Carsten likes
to remind me) to start to give any roadmap as to how it would be
possible - but here are a few ideas.

The first step would be to install the Axis servlet parallel to the
Cocoon servlet and write a service, handler, pivot that can bridge into
Cocoon. One simple way would be to hook into the SOAP processing and
call the relevant pipeline based on what is sent. Later we could then
merge the servlets so that we only have one endpoint. But then again
having it seperate may allow better scalability.

Ok, so then how can we publish a pipeline as WSDL? Well perhaps we can
use Views for that. Something like a WebService view that the bridging
class can then turn into WSDL. Axis allows WSDL generation on the fly if
you append "?wsdl" to the URI. So maybe something there would work.

It is not that I don't think the HP solution is a good idea and perhaps
it fits Cocoon even better than Axis would. However at the moment I
would be very interested in how the HP solution caters for stuf like
WSDL. Does it?

I know I am repeating this but: If we think Cocoon can move in this
direction then we really really need some way of generating WSDL from a
set of pipelines.

Imagine firing up Visual Studio .Net and being able to generate a Visual
Basic program that can call a Cocoon pipeline - just by accessing the
WSDL that the pipeline has provided.

Ok, so any comments welcome. Fire away.

Matthew Langham
________________________________________________________________
Keine verlorenen Lotto-Quittungen, keine vergessenen Gewinne mehr! 
Beim WEB.DE Lottoservice: http://tippen2.web.de/?x=13



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to