cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johann Bertscheit <jbertsch...@apexmail.com>
Subject How to transform URL-parameters and XML-input into a XML-DOM structure in a Cocoon 1.5 producer?
Date Wed, 29 Dec 1999 11:23:40 GMT
Hi cocoon-fans,

I try to use cocoon as a pure XML-Framework for B2B communication.
In order to achieve this it is neccsessary to transform user input (in
form of URL / XML - data) to internal XML.

I have the following problem with cocoon 1.5:
I want to write a producer with the following semantics:

the producer should transform:
1.) URL-parameters into a XML-DOM structure (the simple case - the URL
can be accessed with HttpServletRequest request.getQueryString)
2.) XML-input (from the http-request) into a XML-DOM structure:
(the more difficult case:
- how to get the type of input (the Content-type) and if it is of type
text/xml?
- how to get the whole POSTed XML-input into a string?
- is it possible to access non normal POSTs (a normal browser POST would
be of Content-type: application/x-www-form-urlencoded - that is not the
case here: I have Content-type: text/xml)

How to achieve this?
Does anyone had the same problem and already has such kind of producer?
I havn't found a predefined producer for this purpose.

{I tried to use the new Cocoon-Producer  "ProducerFromRequest" but it
dont works in the cocoon 1.5 environment:
java.lang.IllegalStateException: Already called getInputStream
             at
org.apache.jserv.JServConnection.getReader(JServConnection.java:941)
             at
org.apache.cocoon.producer.ProducerFromRequest.getStream(ProducerFromRequest.java:28)

Does someone know what the problem is here?}

I know that I must access HttpServletRequest but maybe someone has
already sample code for this purpose.

To be more specific here an example of what I want to implement:

- It sould be possible to send the following pure-URL request to sent to
Cocoon:

e.g.
{ echo 'GET /invoke/PriceData?matno=BNX:3000N&ifa=34352542&qty=1
HTTP/1.0'; echo ''; sleep 1;} | telnet cocoon-host 4444

this should be mapped by the producer to a XML-Structure:

e.g.
<URL-params>
    <matno>BNX:3000N</matno>
    <ifa>34352542</ifa>
    <qty>1</qty>
</URL-params>

- It sould be possible to send the following pure-XML request (XML-POST)
should be sent to Cocoon:

e.g:
{ echo 'POST /invoke/PriceData HTTP/1.0\nContent-type:
text/xml\nContent-length:
102\n\n<?xmlversion="1.0"?><PriceQuery><matno>BNX:3000N</matno><ifa>34352542</ifa><qty>1</qty></PriceQuery>\n\n\n';
sleep 10;} | telnet cocoon-host 4444

e.g.
<XML-params>
    <PriceQuery>
        <matno>BNX:3000N</matno>
        <ifa>34352542</ifa>
        <qty>1</qty>
    </PriceQuery>
</XML-params>

- it should be possible to send a mixture of URL and XML input
parameters >> a merge of above two cases

How to access the required information in the context of a
cocoon-producer?

Thanks in advance!

Johannes



--
                               \\\|///
                                /   \
                               ( o o )
+--------------------------.oo0O-(_)-O0oo.-------------------------------+
|                                                                        |
| Johannes A. Bertscheit     Phone: +49 821 54 40 46                     |
| Dipl.Informatiker (Univ.)  FAX:   +49 821 52 37 34                     |
| JB Management & Consulting Mobil: +49 172 84 05 109                    |
| Faerberstrasse 5           EMail: jbertscheit@apexmail.com             |
| D-86157 Augsburg           EMail-Mobil: Johann.Bertscheit@d2privat.com |
| Germany                                                                |
|                          .oooO                                         |
|                          (   )   Oooo.                                 |
+----------------------------\ (----(   )--------------------------------+
                              \_)    ) /
                                    (_/






















Mime
View raw message