Developing OTDs for Communication Adapters

Working With the Server OTD

Use the OTDs Request and Response nodes to build the logic in your HTTPS Collaborations. The HTTP response is not sent back to the HTTP client until sendResponse() method is called on the HTTP server input OTD.

Figure 1–4 sendResponse() Method

sendResponse() Method

It is critical that you use this method to send the response back to the client. Otherwise, the client will wait indefinitely for the response. HTTP requires that a response be sent to the client whether the response is a valid application response or an application error response.

Collaboration Example

The following example shows a simple Java Collaboration that retrieves the HTTP method from the Request node through the Method property. This creates an HTML response indicating the HTTP method. This method is retrieved from the request, sets the ContentType property as “text/html” on the Response node. It then sets the Text property with the HTML response, and then calls the sendResponse() method. This is called on the HTTP server input OTD to send the constructed response to the HTTP client.

Figure 1–5 sendResponse() Example

sendResponse() Example