Using HTTP to Send and Receive Dynamic Headers
A request is sent to the server by the client. The server accepts the request and the HTTP connection is then closed by the response activity. Dynamic headers are added on both the client request and server's response.
The server process listens for requests and sends a response from the server.
The client process sends a request to the server.
Procedure
Result
A DynamicHeaders.log file is created at c:\tmp\DynamicHeaders with the following output:
Headers Received at the Server Side are:
content-type:text/plain
content-type1found_ContentType1_firstTime
content-type1found_ContentType1_SecondTime
arraydata2
arraydata1
arraydata3
Headers Received at the Client Side are:
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 12
server: Jetty(8.1.16.v20140903)
testing-mydata: Done Setting data
testing-mydata: Done Setting Dynamic Value
company: TIBCO India Pvt Ltd
company: TIBCO Inc, USA
Understanding the Configuration
The ListeningHTTPConnection and the RequestingHTTPConnection is defined to listen on port 13009. To change the port, specify a new Port value in the Module Properties dialog. You can also change the default location of the OUTPUT_FILE file, by specifying it in the Module Properties dialog.
The Incoming HTTP Request process starter listens on the connection specified by the ListeningHTTPConnection shared resource.
In the DynamicHeadersClientProcess, the ArrayData element in the Input Editor of the Send HTTP Request activity has Cardinality defined as Repeating. The dynamic header value for the same is provided from the Input tab under the DynamicHeaders element. The dynamic headers Content-Type1 and Content-Type are defined under the same.
In DynamicHeadersServerProcess, the Testing-MyData element in the Input Editor of the Send HTTP Response activity has Cardinality defined as Repeating. The dynamic header value for the same is provided from the Input tab under the DynamicHeaders element. The dynamic headers StatusLine and Company are defined under the same.
The Send HTTP Request activity sends the request to the server. The HTTP Receiver activity accepts the request. The Send HTTP Response activity closes the HTTP connection that has been established by the Incoming HTTP Request process starter.