cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Arbogast <sebastien.arbog...@gmail.com>
Subject Re: Cocoon and Axis
Date Fri, 03 Jun 2005 18:04:40 GMT
> Sebastien,
>
> Can you please explain a bit what you are trying to achieve? (use
> case?). Do you need to use Axis handlers? Where is your business logic
> going to reside (java objects? ejb?)

Alright. My Cocoon application is based on a Spring business logic and
I'm using Flowscript as a controller language.
What I want to achieve is quite simple in fact. My application can
receive traditional http requests (for back-office administration) or
SOAP webservice requests (let's say over HTTP for now) for services.
Jan Hinzman came up with an interesting approach to get the SOAP
envelope out the the request using Cocoon sitemap and a
StreamGenerator. But then he uses a JXTemplate and some XSLT
stylesheets to extract information from the SOAP envelope he has
stored in a ByteArrayOutputStream, and then to rebuild a SOAP answer
to send back. It works for his small sample with an echo webservice,
but I intend to use more complex features of SOAP, including
attachments.
I'm reading the excellent "Building Web services with Java" and in the
chapter about "Implementing Web Services with Apache Axis" they say
that :

"When you use Axis as a SOAP server, the first thing that happens is
that a transport listener receives a message. Transport listener is a
fancy term for any software that can take input and turn it into
something that Axis understand. For example this might be a
servlet..."

And I thought it would be great if it could be some Cocoon component.
So more concretely here is the use case :
1- a user sends a SOAP request to this address :
http://localhost:8080/myapp/modules/echo.ws
2- I have a sitemap pipeline matching that request in
http://localhost:8080/myapp/modules/sitemap.xmap

           <map:match pattern="*.ws">
               <map:call function="webservice">
                   <map:parameter name="module" value="{1}"/>
               </map:call>
           </map:match>

3- In the "webservice" flowscript function there are two possible subcases :
3.1 - Either I manage to get or build a org.apache.axis.MessageContext
object from the request that lead me there and it's great because I
can use all the Axis handler facilities and combine flowscript and my
Spring business layer to provide the service and build the response
3.2 - Or it's not possible and at least I'd like to use Axis Message
API to manipulate my SOAP envelope instead of fiddling something dirty
with JXT/XSLT. If I have to do that, I'm looking for a way to build a
org.apache.axis.Message from the ByteArrayOutputStream I get in
soapEnvelope variable thanks to this flowscript code :

var soapEnvelope = new java.io.ByteArrayOutputStream();
cocoon.processPipelineTo("soapEnvelope", null, soapEnvelope);

And this sitemap pattern :

           <map:match pattern="soapEnvelope">
               <map:generate type="stream"/>
               <map:serialize type="xmlnope"/>
           </map:match>

The thing is I'm just learning to use Axis (I'm currently finishing to
read this chapter about it) and I don't know Cocoon architecture
enough to know what is possible or not here. You may say "then RTFM
and come back later" but I only have 2 days to come up with a working
prototype of my system and this is the last part of it so... I was
thinking I could speed it up thanks to your more pragmatic approach.
Anyway, if you need any precision, feel free to ask.

--
S├ębastien Arbogast

Mime
View raw message