cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morley Howell" <morle...@cogeco.ca>
Subject RE: HTTP Post using XML
Date Fri, 23 Jan 2004 20:55:52 GMT
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!

Thanks,

Morley

> -----Original Message-----
> From: Chris Chesney [mailto:cchesney@go-integral.com]
> Sent: Friday January 23, 2004 2:44 PM
> To: users@cocoon.apache.org
> Subject: RE: HTTP Post using XML
>
>
> Morley,
>
> The latter -- they expect a POST with enctype 'text/xml' and the XML is
> being read directly from the Request InputStream.
>
> One of the other problems I'm concerned about is the ability to utilize
> the output from a service, as this may be the input to multiple other
> services.  Would I need to write this out as a file first?  I looked at
> the SourceWriting Transformer and the Known Problems and Warning section
> concern me.
>
> The flow looks like this:
>
> 1. HTTP request with params
> 2. Service A
> 3. Service B
> 4. Service C
> 5. Aggregate and Output as HTML
>
> 1 -> 2 -------\
>   |            -> 5
>   -> 3 -> 4 ->/
>
> Do you know if the sitemap could handle something like this?
>
> Thanks for your thoughts,
>
> Chris
>
> -----Original Message-----
> From: Morley Howell [mailto:morley-h@cogeco.ca]
> Sent: Friday, January 23, 2004 10:39 AM
> To: users@cocoon.apache.org
> Subject: RE: HTTP Post using XML
>
> Chris,
>
> When you say that the servlets want an XML document in the request body,
> what exactly are they expecting? Are they expecting a POST with enctype
> 'multipart/form-data', like from a file upload form? Or are they
> expecting a POST with enctype 'text/xml', with the XML being read
> directly from the Request InputStream?
>
> Morley
>
> -----Original Message-----
> From: Chris Chesney [mailto:cchesney@go-integral.com]
> Sent: Thursday January 22, 2004 11:44 PM
> To: users@cocoon.apache.org
> Subject: RE: HTTP Post using XML
>
>
> Morley,
>
> Yes, the servlets expect the data to be passed via an HTTP POST.  I was
> not aware that the CInclude Transformer could be used for an HTTP POST,
> so thank you for pointing that out.  However, I don't think it would
> work in my case, if I'm reading it right.  It looks like you can specify
> XML in a parameter, but it doesn't allow you to specify an XML document
> to be sent as the request body of the POST, correct?
>
> Chris
> -----Original Message-----
> From: Morley Howell [mailto:morley-h@cogeco.ca]
> Sent: Thu 1/22/2004 10:26 PM
> To: users@cocoon.apache.org
> Cc:
> Subject: RE: HTTP Post using XML
>
>
> Chris,
>
> I'm assuming from the title of your message that the servlets you're
> talking
> about expect to have data passed to them in an HTTP POST? If so, the
> only
> way I know of to do a POST from Cocoon is with the CInclude transformer.
> Check out the 'advanced' section of this page:
>
> http://cocoon.apache.org/2.1/userdocs/transformers/cinclude-transformer.
> html
>
> There may be other ways to do a POST from Cocoon, but this is the only
> one I
> know. Anyone else?
>
> Morley
>
> -----Original Message-----
> From: Chris Chesney [mailto:cchesney@go-integral.com]
> Sent: Thursday January 22, 2004 7:54 PM
> To: users@cocoon.apache.org
> Subject: HTTP Post using XML
>
>
> I need to write a reporting application that obtains data from multiple
> services, transforms it and returns it as HTML.  The services are
> servlet
> based and accept an XML document as input and returns an XML document as
> output.  Some of the output from one service call will be used as input
> in
> another service call.
>
> Can anyone tell me what generator(s) I would use to accomplish this, or
> do I
> need to write one myself?  Sorry if this is obvious - I've spent a
> couple
> days searching, but can't find the answer.
>
> Thanks in advance,
>
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Mime
View raw message