cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@upaya.co.uk>
Subject Re: HTTP Post using XML
Date Fri, 23 Jan 2004 21:28:13 GMT
Morley Howell wrote:

>Chris,
>
>Hmm, I'm not sure how you would do a 'text/xml' POST from Cocoon. If the
>CInclude transformer doesn't do that, I wonder what it would take to extend
>it to allow that. You could envision something like:
>
><cinclude:includexml>
>  <cinclude:src>http://whatever.com/servletA</cinclude:src>
>  <cinclude:configuration>
>    <cinclude:parameter>
>      <cinclude:name>method</cinclude:name>
>      <cinclude:value>POST</cinclude:value>
>    </cinclude:parameter>
>    <cinclude:parameter>
>      <cinclude:name>enctype</cinclude:name>
>      <cinclude:value>text/xml</cinclude:value>
>    </cinclude:parameter>
>  </cinclude:configuration>
>  <cinclude:body>
>    <your_content_here/>
>  </cinclude:body>
></cinclude:includexml>
>
>Heck for all I know it may already support the 'enctype' parameter, but I'm
>guessing it doesn't support anything like the <cinclude:body> tag that I've
>invented.
>
>If nobody on this list can enlighten us on doing a text/xml POST from
>Cocoon, either using CInclude or something else, then you might want to post
>something on the dev list.
>
>If all else fails, maybe you could write your own 'proxy' servlet to help
>out here. It could take two parameters, one with the URL to your service
>servlet, and one with the XML you want to send to that servlet. You call the
>other servlet with the XML in the POST body, and return whatever it
>produces. You could then call the proxy servlet using the existing cinclude
>transformer, and it would call the real servlet for you. Seems like a bit of
>a hack, there should be a better way!
>
>As far as your second question, you could do the stuff that you're
>describing using CInclude and XSLT. You could start with an XML file with
>two cinclude tags in it, one to access Service A and one to access Service
>B. You run that through the cinclude transformer, and the resulting XML
>contains the output from both services. You could then use XSLT to add
>another cinclude tag to call service C with the output from service B
>embedded in the cinclude tag. You run that through the cinclude transformer
>again, and you're now ready to do your aggregation using some more XSLT.
>
>It's complicated, and there may be a better way, but it would work. Well, IF
>the cinclude transformer supported XML POSTS that is!
>  
>
In Cocoon's proxy block there are two generators, proxy and ws. Both do 
much the same thing, and both use the Jakarta commons HttpClient which 
is capable of doing HTTP Post with an XML body, but neither generator 
actually allows it. I would recommend extending one of these two to make 
it possible. It shouldn't be that hard.

If you want, work out how you'll do it and then post on the dev list to 
get comments.

Regards, Upayavira



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message