Hi Grzegorz,

Thanks for your quick reply.

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     = new 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'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.

Andy


Grzegorz Kossakowski wrote:
Andrew Chamberlain pisze:
  
Hi All,

Just wondering if anyone can help.  As part of a service I'm
constructing, I need to send an XML request to an external service by
HTTP Post.  For this, I'm looking at using the CInclude transformer, but
all the examples I can find seem to use a parameter to pass the data,
rather than sending it as part of the payload (which the external
service expects).
    

What do you mean by "part of the payload"?

  
Has anyone managed to do this, or am I looking at the need for an
external Java class?  Any advice/ideas would be much appreciated.

I'm using Cocoon (2.1.10) under JBoss (4.0.5 GA).
    

When it comes to 2.1.x version, I think you will have to extend CInclude transformer or write your
own. Sébastien Geindre has asked question about similar functionality yesterday but he uses Cocoon
2.2, that thread[1] may be helpful for you to get an idea what Cocoon 2.2 can offer you in regard to
this.

If you want more help you will need to tell us what kind of data do you want to POST and where it
comes from. Switching to C2.2 is also worth consideration if your project is in early stages of
development.

[1] http://www.mail-archive.com/[email protected]/msg39591.html

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

Reply via email to