On Wed, 2 Aug 2000, Doody, John wrote:
> I just installed Cocoon 1.7.4 on a Sun machine running JRun 2.3.3. So far,
> so good. Now I need to call a service which will send back a block of XML.
> The service will most likely be a Java socket program. I would generally
> make the call to the socket program from a servlet. However, the cocoon
> documentation states servlet output is not to be piped to cocoon. It
> appears I need to write a producer. The documentation doesn't go into a lot
> of detail about how to implement the producer.
>
> I would appreciate some help on how to develop and implement producers (or a
> reference to such).
is very simple. just write a class that implements the producer
interface. however, all you really need is a simple(ish) XSP
page. something like this:
<xsp:page>
<page>
<xsp:logic>
InputStream stream = mySocketCall();
InputSource source = new InputSource(stream);
xspCurrentNode.appendChild(
XSPUtil.cloneNode(
this.xspParser.parse(source).getDocumentElement(),
document
)
);
stream.close();
</xsp:logic>
</page>
</xsp:page>
- donald
|