You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Adam Griffiths <ao...@gmail.com> on 2011/07/26 09:19:36 UTC

Generate From XML Webservice with HTTP Headers

Hi

I'm using cocoon 2.2 and would like to use the XML webservices provided by
an OpenRDF Sesame server  as a source for the the generate stage in my
pipeline. I am using the file generator but it is currently not working for
me because I cannot control the HTTP Headers in the GET request that is sent
from Cocoon to Sesame. In order for Sesame to return valid XML the "Accept"
header needs to be set. Also in some use cases in ned to send a POST request
from Cocoon for Sesame to return the XML I'm after.

Is there any way to achieve this using Cocoon? I'm basically looking for a
generator that can call a web service as it's source, with a little more
fine control over the http headers.

I have added some examples of the problem and what I'm trying to achieve
below.

Many thanks

Adam




My pipeline

         <map:match pattern="repositories">

        <map:generate src="http://localhost:8080/openrdf-sesame/repositories
" type="file"/>

        <map:serialize type="xml"/>

      </map:match>

The GET request _required_ for this generator:

GET /openrdf-sesame/repositories HTTP/1.1
Host: localhost
Accept: application/sparql-results+xml, */*;q=0.5

The GET request actually sent for this generator:

GET /openrdf-sesame/repositories HTTP/1.1
Host: localhost


Also would like to send POST requests like:

POST /openrdf-sesame/repositories/mem-rdf HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Accept: application/rdf+xml, */*;q=0.5

query=construct%20{?s%20?p%20?o}%20where%20{?s%20?p%20?o}





zzz