Hi
Another approach I would try is to use HttpClient [1] from a flow script. In flow, you can instantiate Java objects and use them. So, you need simply create an HttpClient object, set its parameters and do a post-method. Get the response and do what ever you want to do with it. Well, actually it is better to do most of the logic in a Java class of your own and just use your Java class from from the flow. By the way, HttpClient jar files are already part of Cocoon. Hope it helps. Regards, Armaz Mellati [1] http://jakarta.apache.org/commons/httpclient/ > -----Original Message----- > From: Lars Huttar [mailto:[EMAIL PROTECTED] > Sent: 27. januar 2006 00:46 > To: [email protected] > Cc: Huttar, Lars (E-mail) > Subject: Re: how to post in 2.1.7? > > I've been asking about how to do a post in Cocoon 2.1.7. > I made progress, in that I can now post using Cinclude. This > was accomplished by applying the patch at > http://issues.apache.org/bugzilla/show_bug.cgi?id=32491 > > However, I then discovered that the remote servlet I'm > connecting to doesn't actually return XML... it returns XML > embedded in Javascript embedded in HTML. :-p CInclude can't > handle a non-wellformed-XML response; you get SAX parsing > errors. (Even if you try to serialize immediately as HTML.) > > Then while googling I came upon the following Q&A from this list: > > On /Mon Apr 26 13:42:46 CDT 2004 , Upayavira wrote:/ > > Antonio Fernandez wrote: > > > > >/Hello everyone, > > />/ > > />/I'm already lost trying to embed an external application into my > > Cocoon app, />/I've tried a couple of things extracted from > searches > > on this list, />/ />/First, I tried something quite simple: > > />/ > > />/ <map:act type="request"> > > />/ <map:generate > > />/src="http://localhost:XXXX/externalApp/index.jsp{requestQuery}" > > <http://localhost:XXXX/externalApp/index.jsp%7BrequestQuery%7D%22> > > />/type="html"/> > > />/ <map:transform src="myApp/resources/xsl/extTransform.xsl"> > > />/ <map:parameter name="use-request-parameters" value="true"/> > > />/ </map:transform> > > />/ <map:serialize type="html"/> > > />/ </map:act> > > />/ > > />/And I was quite happy until I reached the first POST. Since I > > wanted to POST />/form data to the external servlet, I used > cinclude, > > />/the way it is documented in the Cocoon docs, section "Including > > External />/XML(advanced)", but at that point I begun getting error > > />/messages since the HTML generated by the external > servlet was not > > correctly />/formed.(lack of ending tags), and they weren't being > > />/corrected by the html generator as in the first try. > > />/ > > />/So, I'd like to know if there is some kind of "html-tidy" > > transformer, />/similar to the html generator, which I could insert > > between the />/cinclude generation and my application > stylesheet, to > > feed it with correct />/data. Or, if you have any other > advice, I'd be > > very grateful to hear />/it. > > />/ > > />/ > > /If you're using cinclude to request content that is coming in as > > HTML, use a cocoon:/ protocol request in your cinclude > request. Then, > > the page referred to by the cocoon: protocol is served by a > pipeline > > that begins with the HTML generator. > > > > Makes sense? > > > > Regards, Upayavira > Antonio's question is exactly the one I want an answer for: > how can you send a POST request, and process the > non-well-formed-XML response? > > I'm hoping I can use Upayavira's solution, but so far I don't > understand it. > Upayavira, the reason (as I understand it) that Antonio is > using cinclude is that the HTML generator can't send a POST. > The documentation refers to post requests, but it seems to > mean that the HTML generator can use an *incoming* post > request as a source, not that it can send a POST request and > use the response as a source -- hence it says to omit the src > parameter. > (http://cocoon.apache.org/2.1/userdocs/html-generator.html) > > So, if Antonio's cinclude uses a cocoon:/ URL that refers to > another pipeline that uses an HTML generator, the HTML > generator will have to pass the POST request on to the > external servlet. But, the HTML generator can't pass on a > POST request, as far as I know. (Please correct me if I'm > wrong!) The web proxy generator (or is it transformer?) can > pass on a POST request, I believe... but can it handle > non-well-formed XML as a response and turn it into something > Cocoon can work with? > > Any advice is appreciated. > > Lars > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
