This source models a HTTP request. It can accept both HTTP GET and HTTP POST requests.
An example of the XML document generated by a GET HTTP request is shown below:
<h:httpRequest
requestURL="http://localhost:8080/xpe/echoTest"
h:timestamp="1120910926202"
encoding="UTF-8"
pipeContext="/echoTest"
path="/echoTest"
pathParent="/"
node="echoTest"
contextPath="/xpe"
uri="/xpe/echoTest"
sessionId="B5D23AD80DB39255291F4B85ED941217"
method="GET"
xmlns:h="http://www.xml.org/pipe/HTTP"
>
<h:requestor
host="127.0.0.1"
/>
<h:heads>
<h:head
name="host"
value="localhost:8080"
/>
<h:head
name="user-agent"
value="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0"
/>
<h:head
name="accept"
value="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
>
</h:head>
<h:head
name="accept-language"
value="en-us,en;q=0.5"
/>
<h:head
name="accept-encoding"
value="gzip,deflate"
/>
<h:head
name="accept-charset"
value="ISO-8859-1,utf-8;q=0.7,*;q=0.7"
/>
<h:head
name="keep-alive"
value="300"
/>
<h:head
name="connection"
value="keep-alive"
/>
<h:head
name="cookie"
value="JSESSIONID=B5D23AD80DB39255291F4B85ED941217"
>
</h:head>
</h:heads>
<h:cookies>
<h:cookie
name="JSESSIONID"
value="B5D23AD80DB39255291F4B85ED941217"
/>
</h:cookies>
<h:params>
<h:param
name="username"
value="fred"
/>
</h:params>
<h:params>
<h:param
name="password"
value="flintstone"
/>
</h:params>
</h:httpRequest>
The following example illustrates the XML generated by this source in response to a POST request:
<h:httpRequest
requestURL="http://localhost:8188/xpe/test/echo"
h:timestamp="1148939208140"
pipeContext="/test/echo"
path="/test/echo"
pathParent="/test/"
node="echo"
contextPath="/xpe"
uri="/xpe/test/echo"
sessionId="cdb88a029b95ac6c"
method="POST"
xmlns:h="http://www.xml.org/pipe/HTTP"
>
<h:requestor
host="127.0.0.1"
/>
<h:heads>
<h:head
name="connection"
value="close"
/>
<h:head
name="content-length"
value="143"
/>
<h:head
name="content-type"
value="text/xml"
/>
<h:head
name="user-agent"
value="Java/1.5.0_04"
/>
<h:head
name="host"
value="localhost:8188"
/>
<h:head
name="accept"
value="text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
/>
</h:heads>
<h:cookies/>
<h:params/>
<h:body
mimeType="text/xml"
>
<authentication
xmlns=""
>
<username>
fred4
</username>
<password>
flintstone
</password>
</authentication>
</h:body>
</h:httpRequest>
These two examples illustrate a number of important points:
- The XML produced by a HTTP GET and a HTTP POST request contain the same HTTP header information.
- The XML produced in response to a HTTP POST request contains the posted data in the body of the request (http:body element)
- The XML produced in response to a HTTP GET request has the parameters expressed as name/value pairs
within the http:params element.
By default XPE establishes a session for each request if one is not already established. Setting the createSession parameter to false within a pipeline
will overide this behaviour thereby stopping XPE from creating a session.
The following example illustrates how the HTTP Request Source is used within an XPE pipeline definition (xpipedef.xml) file: