You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bartlomiej Frackiewicz <fr...@inity.de> on 2002/06/23 18:06:42 UTC
Transforming URL Requests (was: Form Question and Sessions from 20.06.2002)
Hi folks,
sorry for my re-posting, but my problem still exists and makes me headache.
i want to transform dynamic xml, which i generate with url requests like http://cart.my.server/perl/GetMyCart?sessionID=lala, so my current sitemap:
<map:match pattern="getmycart.html">
<map:act type="request">
<map:parameter name="parameters" value="true"/>
<map:generate src="http://cart.my.server/perl/GetMyCart{requestQuery}"/>
<map:transform type="xslt" src="stylesheets/getmycart.xsl">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
</map:act>
<map:serialize/>
</map:match>
works fine, but i need to post data and than this solution does not work. so i have learned this weekend the xsp pages, and thought this would work in a xsp page:
<snip language="Java"> :-)
URL u = new URL("http://cart.my.server/perl/GetMyCart?sessionID=lala");
HttpURLConnection huc = (HttpURLConnection) u.openConnection();
huc.setRequestMethod("POST
huc.connect();
InputStream in = huc.getInputStream();
int c;
while ((c = in.read()) != -1) {
text.append((char)c);
}
..
return text.toString();
</snip>
but this is not interpreted as xml, it is already well-formed and all chars are escaped (i. e. <) so my xslt transformer nothing matches, btw i am not a java programmer so don't laugh about my code. what is the trick here? can i use jsp-pages (which currently do not run on my tomcat3/cocoon2 server) to print out the clear xml, must i use the Stream Generator (which i absolutly don't understand how this work), or is this not possible with core cocoon?
please point me to the right direction, i thank you in advance.
happy coding, bart
p.s. here is an example of an request to http://cart.my.server/perl/GetMyCart?sessionID=lala copied out of internet explorer.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<response>
<service request-status="complete">
<messageID>1024848144s27995</messageID>
<sessionID>lala</sessionID>
<request-param count="3">
<param name="mediumID">1</param>
<param name="languagecode">ger</param>
<param name="sessionID">lala</param>
</request-param>
</service>
<message>
<cart-list count="0" />
</message>
</response>
--
BARTLOMIEJ M. FRACKIEWICZ
systementwickler
inity - agentur fuer neue medien gmbh
birkenstrasse 71
40233 duesseldorf
telefon: 0211-99199-0
fax: 0211-99199-10
e-mail: frackiewicz@inity.de
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Transforming URL Requests (was: Form Question and Sessions from
20.06.2002)
Posted by Ivelin Ivanov <iv...@apache.org>.
Bartlomiej,
I don't have an immediate solution for your problem, but I am currently
working on a new generator: HttpProxyGenerator.
It is specifically intended to allow easy integration of XML content
across multiple portals. The original idea was an extention to XMLForm
which would allow interaction between an end user and a portal, where
the logic and content is provided by a third party vendor.
The implementation will be based on Jakarta HttpClient to allow more
sophisticated connection handling, request manipulation, redirects
following, session handling, login, etc.
I am glad that you reached to the same idea independently.
Maybe you can help me iron out the requirements.
Can you describe the use case scenario for the problem you're trying to
solve.
What markup do you use for form submission to Cocoon and then to the
perl server? Have you considered XForms?
http://xml.apache.org/cocoon/howto/xmlform-wizard/howto-xmlform-wizard.html
Regards,
Ivelin
Bartlomiej Frackiewicz wrote:
> Hi folks,
>
> sorry for my re-posting, but my problem still exists and makes me headache.
>
> i want to transform dynamic xml, which i generate with url requests like http://cart.my.server/perl/GetMyCart?sessionID=lala, so my current sitemap:
>
> <map:match pattern="getmycart.html">
> <map:act type="request">
> <map:parameter name="parameters" value="true"/>
> <map:generate src="http://cart.my.server/perl/GetMyCart{requestQuery}"/>
> <map:transform type="xslt" src="stylesheets/getmycart.xsl">
> <map:parameter name="use-request-parameters" value="true"/>
> </map:transform>
> </map:act>
> <map:serialize/>
> </map:match>
>
> works fine, but i need to post data and than this solution does not work. so i have learned this weekend the xsp pages, and thought this would work in a xsp page:
>
> <snip language="Java"> :-)
> URL u = new URL("http://cart.my.server/perl/GetMyCart?sessionID=lala");
> HttpURLConnection huc = (HttpURLConnection) u.openConnection();
> huc.setRequestMethod("POST
> huc.connect();
>
> InputStream in = huc.getInputStream();
>
> int c;
> while ((c = in.read()) != -1) {
> text.append((char)c);
> }
>
> ..
>
> return text.toString();
> </snip>
>
> but this is not interpreted as xml, it is already well-formed and all chars are escaped (i. e. <) so my xslt transformer nothing matches, btw i am not a java programmer so don't laugh about my code. what is the trick here? can i use jsp-pages (which currently do not run on my tomcat3/cocoon2 server) to print out the clear xml, must i use the Stream Generator (which i absolutly don't understand how this work), or is this not possible with core cocoon?
>
> please point me to the right direction, i thank you in advance.
>
> happy coding, bart
>
> p.s. here is an example of an request to http://cart.my.server/perl/GetMyCart?sessionID=lala copied out of internet explorer.
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <response>
> <service request-status="complete">
> <messageID>1024848144s27995</messageID>
> <sessionID>lala</sessionID>
> <request-param count="3">
> <param name="mediumID">1</param>
> <param name="languagecode">ger</param>
> <param name="sessionID">lala</param>
> </request-param>
> </service>
> <message>
> <cart-list count="0" />
> </message>
> </response>
>
>
--
-= Ivelin =-
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>