cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hinzmann <>
Subject Re: Cocon and WebServices
Date Wed, 01 Jun 2005 17:42:44 GMT
Hi Sebastien,

:D thanks for your faith!

If I find some time, I'll surely will write a little more in the wiki.
At the moment I have to do lot of work for my studies ...

... but  I tried to explain the way, I managed to do a webservice in this 
I also hacked a little example and attached it to the wikipage

Anyway, in basic you'll have to do something like:

1. receive the SOAP-request
2. extract the methodname, which is called and then
    extract eventually methodparameters
3. process some computation
4. generate and send SOAP-Answer back to the client

1. receiving a SOAP-request
1.1 You'll have to match the request in the sitemap and call your flowscript.
1.2 In the flowscript you generate the SOAP-Envelope using a sitemap-matcher 
      with a StreamGenerator. And serialize it without the XML-Declaration 
     (configure a XMLSerializer with 
1.3 You then store the SOAP-Envelope in a variable for latter use

Now you have the XML-File which was sent by the client.
You have now to learn, which Method the client is calling:

2. Extracting the Method out of the SOAP-Envelope
2.1 The name of the Node, which follows the <soapenv:Body>-node, is the 
      method-name (typically something like <ns1:methodname ...>).
2.2 To generate the SOAP-Envelope in the sitemap, you need the JXTemplate with 
      the method 'stringToSAX' described in the wiki 
2.3 You then transform the Envelope with a stylesheet, that extracts the 
      methodname ... see soapMethod.xsl
2.4 Store this String in a variable and build an if-cascade over the possible 
2.5 if no if-statement matches, you should generate a soap-fault

Now you are almost done.
You have the methodname and the parameters, so you'll know what to do.

3.1 do the work for your method

Now it's time to generate the answer. This can be a SOAP-Fault with an 
exceptionmessage in it or some String describing the answer, a 
XML-Document, ...

4.1 in the flowscript use the cocoon.sendPage(...) method to send back the 
4.2 in the sitemap generate a dummy.xml and
4.3 transform it with a soapAnswer.xsl. this is where the SOAP-Envelope is 
stored. You have to pass your answer as parameter to the transformation.
4.4 serialize the answer as xml to the client.

5. done

I hope this helps. I would write more and better, but  the time .... ;)

have to wait, because i have to leave for now :(

On Wednesday 01 June 2005 06:42, Sebastien Arbogast wrote:
> 2005/5/31, Jan Hinzmann <>:
> > The Axisblock doubled my code, so I came up with a
> > "plain-cocoon-soap-webservice"
> > 
> > The Axis-Block is just a kind of Proxy.
> > 
> > Sorry for the short answer.
> Actually I could really use a more detailed answer if you had time
> because I really need to figure out how to expose webservices through
> Cocoon and I don't manage to understand your article on the Wiki.
> Would it be possible for you to write a small sample, a very simple
> Cocoon application that just exposes your echo webservice so that one
> can just test it through XMLSpy SOAP request for example, and then
> build something more sophisticated on top of that.
> I know it can represent a bit of work for you but as you seem to be
> the most advanced on this subject, I can do nothing but to place all
> my faith in you ;-)
> Thx in advance.
> Cheers.
> -- 
> Sebastien ARBOGAST
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Gruß, Jan

View raw message