HTTPInput node

This topic contains the following sections:

Purpose

Use the HTTPInput node to receive Web service requests for processing by a message flow. Using the HTTPInput node with the HTTPReply and HTTPRequest nodes, the broker can act as an intermediary for Web services, and Web service requests can be transformed and routed in the same way as other message formats supported by WebSphere Business Integration Message Broker.

If you include an HTTPInput node in a message flow, you must either include an HTTPReply node in the same flow, or pass the message to another flow that includes an HTTPReply node (for example, through an MQOutput node to a second flow that starts with an MQInput node). In the latter case, the request from, and reply to, the client are coordinated by the request identifier stored in the LocalEnvironment (described below).

The HTTPInput node handles messages in the following message domains:

  • MRM
  • XML
  • XMLNS
  • JMS
  • BLOB

When the HTTPInput node receives a message from a Web service client, it invokes the appropriate parsers to interpret the headers and the body of the message, and to create the message tree that is used internally by the message flow. The node creates a unique identifier for the input message and stores it as a binary array of 24 bytes in the LocalEnvironment tree at LocalEnvironment.Destination.HTTP.RequestIdentifer. This value is used by the HTTPReply node and must not be modified in any way.

HTTP messages are always non-persistent, and have no associated order.

HTTP messages are non-transactional. However, if the message flow interacts with a database or another external resource such as a WebSphere MQ queue, these interactions are performed transactionally. The HTTPInput node provides commit or rollback depending on how the message flow has ended, and how it is configured for error handling (how failure terminals are connected, for example). If the message flow is rolled back by this node, a SOAP Fault message is generated and returned to the Web service client.

If an exception occurs downstream in this message flow, and is not caught but is returned to this node, the node constructs an error reply to the calling client. This reply is a SOAP Fault message derived from the exception itself.

If you include an output node in a message flow that starts with an HTTPInput node, it can be any of the supported output nodes (including user-defined output nodes). You can create a message flow that receives messages from Web service clients and generates messages for clients that use all supported transports to connect to the broker, because you can configure the message flow to request the broker to provide any conversion that is necessary.

If you create a message flow to use as a subflow, you cannot use a standard input node; you must use an instance of the Input node as the first node to create an in terminal for the subflow.

If your message flow does not receive Web service requests, you can choose one of these other input nodes:

  • MQeInput
  • MQInput
  • Real-timeInput
  • SCADAInput
  • A user-defined input node

The HTTPInput node is represented in the workbench by the following icon:

HTTPInput node icon

Using this node in a message flow

You can use this node in two different scenarios:

  1. The broker acts as the Web service.

    The Web service client generates a Web service request. This is directed to the HTTPInput node of a message flow running in the broker. You design the message flow to process the message in some way, and to generate a response that is in the format of a Web service response. The broker sends the response to the Web service client through the HTTPReply node of the message flow.

    For example, you have Web service clients that interact with a Web service that provides specific information on a given subject (stock prices or exchange rates, for example). You replace this service with an inhouse database lookup solution, but want to make no changes to your client applications. You design a message flow including an HTTPInput node that receives requests from your clients. This node connects to a Compute node that retrieves the required information from the database and generates a new output message, in the form of a Web service response including this new data. The Compute node passes the message on to the HTTPReply node, which generates the response for the Web service client.

  2. The broker acts as an intermediary to the Web service.

    The Web service client generates a Web service request. This is directed to the HTTPInput node of a message flow running in the broker. You design the message flow to process the message in some way, and to interact with the Web service to which the client application believes it is connected. You include an HTTPRequest node in the message flow to send a request to the Web service and to receive the response. The message flow also generates a response to the client, based in full or in part on the response received in the HTTPRequest node, in the format of a Web service response. The broker sends the response to the Web service client through the HTTPReply node of the message flow.

    For example, you have a client application that interacts with a Web service that sends information to another application requiring the information in another format. You design a new message flow that includes an HTTPInput node, an HTTPRequest node, and an HTTPReply node. The HTTPInput node receives the input from the Web service client, and passes the message to the HTTPRequest node, which interacts with the Web service.

    When the response is received, the HTTPRequest node propagates the message to a Compute node, which creates an output message in legacy format from the content of the Web service response. The message flow ends with an MQOutput node, which delivers the transformed message to the legacy application, followed by an HTTPReply node that provides the appropriate response to the Web service client.

    In a second example, your clients interact with a Web service, and you want to retain information about the requests to the Web service for audit purposes. You design a message flow that includes an HTTPInput node connected to a Warehouse node. The input message received from the Web service client is stored in the database, and the Warehouse node passes the message on to an HTTPRequest node, which interacts with the Web service. When the response is received, the HTTPRequest node propagates the response to the HTTPReply node, which generates the response for the Web service client.

Configuring the HTTPInput node

When you have put an instance of the HTTPInput node into a message flow, you can configure it. Right-click the node in the editor view and click Properties. The node's basic properties are displayed in the properties dialog.

All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk on the properties dialog.

Configure the HTTPInput node as follows:

  1. In URL Selector, enter the URL from which this node receives Web service requests.
  2. Enter the Maximum client wait time timeout interval, as a number of seconds. This is the length of time that the TCP/IP listener that received the input message from the Web service client waits for a response from the HTTPReply node in the message flow. If a response is received within this time, the listener propagates the response to the client. If a response is not received in this time, the listener sends a SOAP Fault message to the client that indicates that its timeout has expired.
  3. Select Default in the properties dialog navigator and set values for the properties describing the message domain, message set, message type, and message format that the node uses to determine how to parse the incoming message.
    • In the Message Domain field, select the name of the parser that you are using from the drop-down list. You can choose from:
      • MRM
      • XML
      • XMLNS
      • JMSMap
      • JMSStream
      • BLOB
    • If you are using the MRM parser, select the correct message set from the drop-down list in the Message Set field. This list is populated with available message sets when you select MRM as the domain.

      Leave the Message Set field blank for XML, XMLNS, JMS, and BLOB parsers.

    • If you are using the MRM parser, select the correct message from the drop-down list in the Message Type field. This list is populated with messages that are defined in the message set that you have selected.

      Leave the Message Type field blank for XML, XMLNS, JMS, and BLOB parsers.

    • Select the format of the message from the drop-down list in the Message Format field. This list includes all the physical formats that you have defined for this message set. If you have used the default names for the physical formats, the list contains:
      • CWF1 (the default Custom Wire Format id)
      • XML1
      • TDS1
      If you specified different (non-default) names for any of these formats, your names appear in this list.

      Leave the Message Format field blank for XML, XMLNS, JMS, and BLOB parsers.

  4. Select Validation in the properties dialog navigator if you want the MRM parser to validate the body of messages against the dictionary generated from the message set. (If a message is propagated to the failure terminal of the node, it is not validated.)
    • Validate is initially set to None. Change this to Content and Value to request both content validation (type content and composition checks) and value validation (value data type checks, null permitted checks, length checks, range checks, enumeration checks, and so on).
    • To determine what happens if validation fails, select one of the following options for Failure Action:
      • User Trace: write all validation failures to user trace and continue processing.
      • Local Error Log: write all validation failures to the event log and continue processing.
      • Exception: throw an exception on the first validation failure. This is the default behavior.
      The first two options are useful when validation is first invoked, because you see all validation failures, not just the first encountered. When you have analyzed the failures, you might typically select Exception for future use.

      The failure destinations behave like those for Trace node output. So if, for example, User Trace is selected, trace entries are written regardless of the setting of the user trace flag for the message flow.

    • Set a value for Timing:
      • Deferred: validate the message as each field is parsed. This is the default behavior.
      • Immediate: validate the message immediately but permit subsets to remain unresolved (this supports Composition values of Choice and Message where the element is not yet resolved).
      • Complete: validate the entire message immediately.
      The options available for this property take advantage of the partial parsing capability of parsers, in that you can choose either to validate only the fields that are accessed (Deferred), or to validate the entire message (Immediate and Complete). The former improves performance, the latter increases security.
    • The Include All Value Constraints check box property is selected and cannot be changed from its default setting. This setting means that full data type checks and value checks are made.
    • The Fix property cannot be changed from its default setting of None. If Failure Action is not set to Exception, limited remedial action is taken when validation failures occur. If you set Failure Action to Exception, no remedial action is taken, and an exception is thrown at the first validation failure.
  5. Select Description in the properties dialog navigator to enter a short description, a long description, or both.
  6. Click Apply to make the changes to the HTTPInput node without closing the properties dialog. Click OK to apply the changes and close the properties dialog.

    Click Cancel to close the dialog and discard all the changes that you have made to the properties.

Connecting the terminals

HTTPInput routes each message that it retrieves successfully to the out terminal. If message validation fails, the message is routed to the failure terminal; you can connect nodes to this terminal to handle this condition. If you have not connected the failure terminal, the message is discarded, the Maximum client wait time expires, and the TCP/IP listener returns an error to the client. The are no other situations in which the message is routed to the failure terminal.

If the message is caught by this node after an exception has been thrown further on in the message flow, the message is routed to the catch terminal. If you have not connected the catch terminal, the message is discarded, the Maximum client wait time expires, and the TCP/IP listener returns an error to the client.

Terminals and properties

The HTTPInput node terminals are described in the following table.

Terminal Description
Failure The output terminal to which the message is routed if an error occurs.
Out The output terminal to which the message is routed if it is successfully retrieved.
Catch The output terminal to which the message is routed if an exception is thrown downstream and caught by this node.

The following tables describe the node properties; the column headed M indicates whether the property is mandatory (marked with an asterisk on the properties dialog if you must enter a value when no default is defined), the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the bar file to deploy it).

The HTTPInput node Basic properties are described in the following table.

Property M C Default Description
URL Selector Yes Yes   The location from which Web service requests are retrieved. You must provide this in one of the following forms:
http://<hostname>[:<port>]/[<path>]
or
/<path fragment>/*
where * is a wildcard that you can use to mean match any.
Maximum client wait time Yes No 180 How long the listener waits, in seconds, before sending an error message back to the client. The valid range is zero (which means an indefinite wait) to (231)-1.

The HTTPInput node Default properties are described in the following table.

Property M C Default Description
Message Domain No No   The domain of the incoming message.
Message Set No No   The message set of the incoming message.
Message Type No No   The type of the incoming message.
Message Format No No   The format of the incoming message.

The HTTPInput node Validation properties are described in the following table.

Property M C Default Description
Validate Yes No None Whether validation takes place. Valid values are None and Content and Value.
Failure Action Yes No User Trace What happens if validation fails. You can set this property only if you have set Validate to Content and Value. Valid values are User Trace, Local Error Log, and Exception.
Timing Yes No Deferred When validation occurs. You can set this property only if you have set Validate to Content and Value. Valid values are Deferred, Immediate, and Complete.
Include All Value Constraints Yes No Selected You cannot change this property.
Fix Yes No None You cannot change this property.

The HTTPInput node Description properties are described in the following table.

Property M C Default Description
Short Description No No   A brief description of the node.
Long Description No No   Text that describes the purpose of the node in the message flow.