Configuring message flows to process timeouts
Connect the HTTP Timeout terminal of the HTTPInput or SOAPInput nodes to further nodes to process timeouts.
Before you begin
- Read the message flows overview.
- Read about the options that you have for processing web service messages, and learn more about SOAP and HTTP.
About this task
You can configure message flows that start with an HTTPInput or SOAPInput node by connecting the HTTP Timeout terminal to further nodes for processing timeouts:
- On HTTPInput nodes, messages are propagated through this terminal only when you have configured your integration servers such that the HTTP nodes are using the embedded integration server listener.
- On SOAPInput nodes, messages are propagated through this terminal only when you are using an HTTP binding, and you have configured your integration servers such that the SOAP nodes are using the embedded integration server listener.
If these conditions are not met when you deploy the BAR file for the message flow that includes one of these nodes, a warning is generated, and the path of the message flow that you have connected to the HTTP Timeout terminal is ignored. No further warnings are generated until the next restart.
To set a static timeout value in an input node:
- Create a message flow, or open an existing flow.
- In the Message Flow editor, select the input node for this message flow. The node properties are displayed in the Properties view (below the editor pane).
- Set an appropriate time for the timeout interval in the property Maximum client wait time. The default
interval is 180 seconds.
If this time expires, and you have not connected one or more nodes to the HTTP Timeout terminal, the listener that received the client request message responds with a SOAP Fault message indicating that a timeout has occurred.
- If you want to provide customized timeout processing, connect one or more nodes to the HTTP Timeout terminal. You must include in this sequence the reply node that matches the input node. Therefore, if your message flow starts with an HTTPInput node, you must include an HTTPReply; if your message flow starts with a SOAPInput node, you must include a SOAPReply node.
To set a dynamic timeout value in an input node:
- Override the timeout value set on the input node by using the Java™ plug-in API to update it in
a JavaCompute node using
the
MbUtilities.changeIdentifierTimeout()
method. The following code shows an example of thechangeIdentifierTimeout
method:MbMessage localEnv = assembly.getLocalEnvironment(); MbElement rootElem = localEnv.getRootElement(); MbElement repIdElement = rootElem.getFirstElementByPath( "/Destination/SOAP/Reply/ReplyIdentifier"); Object repId = repIdElement.getValue(); boolean success = changeIdentifierTimeout((byte[])repId, timeout);
- Override the timeout value set on the input node by using the CHANGEIDENTIFIERTIMEOUT function.
- Read a record from a database.
- Use a value from a field within the message body.
By propagating from the HTTP Timeout terminal you can then change the contents of the responses that your message flow sends to the client. The processing on the sequence of nodes that you connect to the HTTP Timeout terminal is also subject to a further timeout, so that the client always gets a response within a known timeout interval.
(0x01000000:Name):HTTP = (
(0x01000000:Name):Input = (
(0x01000000:Name):Timeout = (
(0x03000000:NameValue):OriginalClientLastWaitTime = 10 (INTEGER)
(0x03000000:NameValue):OriginalClientWaitTime = 15 (INTEGER)
(0x03000000:NameValue):OriginalMessageMadeTheFlow = TRUE (BOOLEAN)
(0x03000000:NameValue):OriginalRequestIdentifier =
X'48545450000000000000000000000000c00c000000000000' (BLOB)
(0x03000000:NameValue):OriginalInboundMessage = X'3c3e' (BLOB)
)
)
)
For SOAPInput nodes
the SOAPReply node connected
on the HTTP Timeout terminal path must send a SOAP fault response
message and the reply status code of 500 cannot be altered. For HTTPInput nodes any response
message can be sent from the HTTP Timeout terminal and the reply status
code can be changed by updating the LocalEnvironment.Destination.HTTP.ReplyStatusCode
message
tree field.