cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franco pace <>
Subject Re: CInclude POST (by Payload)
Date Wed, 29 Aug 2007 21:56:47 GMT
Hi Andrew,
Attached is the source code of the transformer I use with cocoon 2.1.10 
to post XML to a webservice. You are free to give it a try and modify to 
your requirements.
Feel free to change the package name (which is set to 
com.franco.pipeline.contenthandler and  com.franco.pipeline.transformation).
You will probably wish to change the namespace that it consumes (from
Once you make these changes compile and package into cocoon (or just 
drop the class files into WEB-INF/classes directory (which is what I do)
and generate XML (via pipeline) that looks like:

<post:post xmlns:post="" 
url="http://someurl....">  <!-- remember change post namespace -->
        <post:request-property name="Content-Type" value="text/xml"/>
          /xml to post goes here.../

main cocoon sitemap config looks like:

<map:transformer logger="sitemap.transformer.log" name="httppost" 
pool-grow="2" pool-max="16" pool-min="2" 
src="com.franco.pipeline.transformation.HTTPPostTransformer"/>  <!-- 
remember to change package name -->
and example usage sitemap match may looks like:

      <map:match pattern="*">
        <map:select type="request-method">
          <map:when test="PUT">
            <map:generate type="stream"/>
            <map:transform src="xslt/putRequest.xsl" type="xslt-saxon">
              <map:parameter name="id" value="{1}"/>
            <map:transform type="httppost"/>
        <map:serialize type="xml"/>

Hope this is usefull for you.

Andrew Chamberlain wrote:
> Hi All,
> Just wondering if anyone can help.  As part of a service I'm 
> constructing, I need to send an XML request to an external service by 
> HTTP Post.  For this, I'm looking at using the CInclude transformer, 
> but all the examples I can find seem to use a parameter to pass the 
> data, rather than sending it as part of the payload (which the 
> external service expects).
> Has anyone managed to do this, or am I looking at the need for an 
> external Java class?  Any advice/ideas would be much appreciated.
> I'm using Cocoon (2.1.10) under JBoss (4.0.5 GA).
> Many thanks,
> Andy
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message