cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Chamberlain <an...@comsine.co.uk>
Subject Re: CInclude POST (by Payload)
Date Wed, 29 Aug 2007 11:26:38 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Grzegorz,<br>
<br>
Thanks for your quick reply.<br>
<br>
I'm afraid I don't know the correct terminology.&nbsp; By "payload" I meant
by using the output stream of the established connection.&nbsp; In Java
terms, it looks like this:<tt><br>
<br>
&nbsp; // Prepare XML request<br>
&nbsp; ByteArrayOutputStream baos = new ByteArrayOutputStream();<br>
&nbsp; baos.write(...);<br>
</tt><tt><br>
&nbsp; // Open and prepare connection<br>
&nbsp; URL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
url&nbsp;&nbsp;&nbsp;&nbsp; = new URL(<a class="moz-txt-link-rfc2396E"
href="http://...">"http://..."</a>);<br>
&nbsp; </tt><tt>URLConnection urlConn = url.openConnection();</tt><br>
<tt>&nbsp; urlConn.setDoInput(true);<br>
&nbsp; urlConn.setDoOutput(true);<br>
&nbsp; urlConn.setRequestProperty("Content-Encoding", "text/xml");<br>
&nbsp; urlConn.setRequestProperty("Content-Type", "application/xml");<br>
&nbsp; urlConn.setRequestProperty("Content-Length",
String.valueOf(baos.size()));<br>
<br>
&nbsp; // Send XML request<br>
&nbsp; urlConn.getOutputStream().write(baos.toByteArray());<br>
<br>
&nbsp; // Read response<br>
&nbsp; BufferedInputStream in = new
BufferedInputStream(urlConn.getInputStream());<br>
&nbsp; in.read(...);<br>
<br>
</tt>I'll take a look at Cocoon 2.2 and S&eacute;bastien's query.&nbsp; 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.<br>
<br>
Andy<br>
<br>
<br>
Grzegorz Kossakowski wrote:
<blockquote cite="mid:46D54CAE.9000904@apache.org" type="cite">
  <pre wrap="">Andrew Chamberlain pisze:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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).
    </pre>
  </blockquote>
  <pre wrap=""><!---->
What do you mean by "part of the payload"?

  </pre>
  <blockquote type="cite">
    <pre wrap="">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).
    </pre>
  </blockquote>
  <pre wrap=""><!---->
When it comes to 2.1.x version, I think you will have to extend CInclude transformer or write
your
own. S&eacute;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] <a class="moz-txt-link-freetext" href="http://www.mail-archive.com/users@cocoon.apache.org/msg39591.html">http://www.mail-archive.com/users@cocoon.apache.org/msg39591.html</a>

  </pre>
</blockquote>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message