Hey, All...

I've been using Cocoon 2.0 for about a month & 1/2 now and 
I've run into the following problem:

First off, refer to the Order example that comes with 
cocoon which when you hit the submit, it will return the 
xml typed into the textarea.  Now, for testing, I've taken 
my xml doc, modified the stream pipeline to use my 
transform and then output html.  Using the same form, 
entered my xml text (cut & Paste from my text file) - hit 
submit and it works like a charm - the generated HTML 
comes back after the transform.

Now, the problem is in an application I'm writing that 
needs to send the XML data as a parameter call to the 
cocoon server and capture the resulting HTML.  Using the 
URL class and URLConnection class, I have to pass the 
parameter (say "Foo") and the URLEncoder.encode value of 
the parameter (URLEncoder.encode(some text))...  The 
problem is that the stream or cocoon doesn't see the 
parameter passed in.  Any ideas on how to get it to 
understand the URLEncoded parameter.

Here's some example code:

StringBuffer uri = new 
StringBuffer("http://localhost:8080/cocoon/request1";);

try {
    URL url = new URL(uri.toString());
    HttpURLConnection u_connect = 
(HttpURLConnection)url.openConnection();
    u_connect.setRequestMethod("POST");
    u_connect.setDoOutput(true);
    u_connect.setRequestProperty("Foo", 
URLEncoder.encode(some text));

    u_connect.connect();

    // print out some results...

} catch (exceptions...) {}

Now, here's some of the output:

content length:  12341
content type  :  text/html
content encode:  null
request method:  POST
response code :  500
response mssg :  Internal Server Error
e:java.lang.NullPointerException

So, in other words it gets there and then returns the 
nullPointerException afterwards.  Now, remember the text 
is pure XML so that's why it needs encoding - the 
URLConnection nor URL will accept it due to illegal 
characters otherwise...

any help would be greatly appreciated...

peace.  JOe...


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to