You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by ck...@gpu.com on 2000/05/15 21:08:00 UTC

Retrieving xml data via HTTP from within a producer


I'm trying to implement a Producer that uses a URLConnection to retrieve an XML
document from another web server (via HTTP, where the document is being
generated dynamically).  When the xml document is retrieved by the Producer, the
Producer will perform some basic edits on the xml document, then  return the xml
document.  I am implementing the URLConnection within getStream().  I have
created a simple Producer, without a URLConnection, which works.  I have also
created a stand-alone Java application that performs the xml document retrieval
by using URLConnection, which also works.  However, after I add the
URLConnection code to the Producer and execute a request I get the following
message:

java.lang.NullPointerException
     at CustomerCareProducer.connectToUrl(Compiled Code)
     at CustomerCareProducer.getStream(CustomerCareProducer.java:27)
     at
org.apache.cocoon.producer.AbstractProducer.getDocument(AbstractProducer.java:95)

     at org.apache.cocoon.Engine.handle(Compiled Code)
     at org.apache.cocoon.Cocoon.service(Cocoon.java:145)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
     at
org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
     at org.apache.jserv.JServConnection.run(JServConnection.java:188)
     at java.lang.Thread.run(Thread.java:479)

Any ideas?
Is there any reason I can't use a URLConnection from within a Producer?

My set-up is as follows:
      Windows Nt 4.0 Workstation sp4
      Apache 1.3.11
      JServ 1.1
      Sun jdk 1.2
      Sun jsdk 2.0
      Cocoon-1.7.2

Thanks,
Chris Kostaras



Re: XSP TagLib documentation (was Re: Retrieving xml data via HTTP from within a producer)

Posted by Sebastien Koechlin I-VISION <sk...@n-soft.com>.
I wrote:

> Ok, I just put some xml files into
> http://212.208.156.119/tstskc/taglib-doc.zip.
> As I does not understand
> every template function, I can have make mistakes.
> 
> I'm going to write a DTD and a HTML xsl, but feel free to
> fill in the blancs (description and examples), or to tell
> me that I'm wrong, it's useless and everything else.

This ZIP-File has just been updated with a DTD and
a HTML xsl file. It's about 7 Kb.

--
Sebastien Koechlin

XSP TagLib documentation (was Re: Retrieving xml data via HTTP from within a producer)

Posted by Sebastien Koechlin I-VISION <sk...@n-soft.com>.
I wrote:

> For Cocoon1, I think that writing an XSP page retrieving an URL is
> possible, still a documentation problem, we need a
> one line description of all thoses XSP lib functions.
> As nobody have time to write it, I'm going to try (with my
> bad english), is there a DTD for this?

Ok, I just put some xml files into
http://212.208.156.119/tstskc/taglib-doc.zip.
As I does not understand
every template function, I can have make mistakes.

I'm going to write a DTD and a HTML xsl, but feel free to
fill in the blancs (description and examples), or to tell
me that I'm wrong, it's useless and everything else.

-- 
Sebastien Koechlin

Re: Retrieving xml data via HTTP from within a producer

Posted by Sebastien Koechlin I-VISION <sk...@n-soft.com>.
ckostaras@gpu.com wrote:
> 
> I'm trying to implement a Producer that uses a URLConnection to retrieve an XML
> document from another web server (via HTTP, where the document is being
> generated dynamically).

Having a URLProducer is a good idea. For people (like me) who still does
not
write Java fluently, it's a easy work-around. We could write Perl CGI,
or
PHP, or anything that will produce XML data, and Cocoon will format this
with XSLT.

Also, modify a CGI to make it produce XML instead of HTML is an easy and
fast job, re-write it as a producer is not.

Does Cocoon2 SiteMap (will) allow this?

For Cocoon1, I think that writing an XSP page retrieving an URL is
possible, still a documentation problem, we need a
one line description of all thoses XSP lib functions. 
As nobody have time to write it, I'm going to try (with my
bad english), is there a DTD for this?

-- 
Sebastien Koechlin