Hi Grzegorz,

The example code I gave was from a stand-alone application.  Within Cocoon itself, I was hoping that the content of the request body could be specified using a cinclude directive.  Say, for instance, using a <cinclude:body> element :

<cinclude:includexml ignoreErrors="false">
  <cinclude:src>http://...</cinclude:src>
  <cinclude:configuration>
    <cinclude:parameter>
      <cinclude:name>method</cinclude:name>
      <cinclude:value>POST</cinclude:value>
    </cinclude:parameter>
  </cinclude:configuration>
  <cinclude:body>
    <myrequest>
      ...
    </myrequest>
  </cinclude:body>
</cinclude:includexml>

If this kind of mechanism was possible, it would be ideal, but perhaps it is in Cocoon 2.2...?  I'll take a look.

Andy


Grzegorz Kossakowski wrote:
Andrew Chamberlain pisze:
  
Hi Grzegorz,

Thanks for your quick reply.
    

No problem.

  
I'm afraid I don't know the correct terminology.  By "payload" I meant
by using the output stream of the established connection.  In Java
terms, it looks like this:

  // Prepare XML request
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  baos.write(...);

  // Open and prepare connection
  URL           url     = "" URL("http://...");
  URLConnection urlConn = url.openConnection();
  urlConn.setDoInput(true);
  urlConn.setDoOutput(true);
  urlConn.setRequestProperty("Content-Encoding", "text/xml");
  urlConn.setRequestProperty("Content-Type", "application/xml");
  urlConn.setRequestProperty("Content-Length", String.valueOf(baos.size()));

  // Send XML request
  urlConn.getOutputStream().write(baos.toByteArray());

  // Read response
  BufferedInputStream in = new
BufferedInputStream(urlConn.getInputStream());
  in.read(...);
    

I see. You just want to post XML in request body section. The most interesting point is how do you
produce this baos data? Is it a result of another Cocoon's pipeline? Is it produced completely
externally from Cocoon?

If I knew this information I would give you exact advice.

  
I'll take a look at Cocoon 2.2 and Sébastien's query.  Although our
project has been underway for a while, we've only been using the XSLT
and SQL transformers, so I'm hoping the differences won't be great.
    

There is a known problem[1] with database caused by changes tracked by COCOON-2083 issue. To provide
a quick fix it's a matter of reverting some commit. This way one will be able to use only Avalon
DataSource but it wouldn't matter for you. I'll try to fix that problem soon.

[1] https://issues.apache.org/jira/browse/COCOON-2106
[2] https://issues.apache.org/jira/browse/COCOON-2083

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

Reply via email to