Before you begin
Prerequisite: You should have a module. The module should have an export with an interface.
About this task
In this set of steps, you will learn how you create an HTTP binding for an export. This popular protocol is used in many circumstances. It is often used by a Web service.If you intend to use the predefined HTTP bytes data binding then you must use the following schema and data handler. Under Predefined Resources in the Dependencies editor, select Native Body schema for Native Body DataHandler. Save your work and close the dependencies editor.
If you intend to use the predefined HTTP bytes data binding with a static service gateway then you must add the service gateway interface and schema files. To add this interface and schema files to your module, open the dependencies editor. Under Predefined Resources, select Service gateway interface and schema files. Save your work and close the dependencies editor.
Procedure
- Open the assembly editor. Under Inbound Exports, select HTTP and drag it to the assembly editor. Select an interface or create one.
no implementation and no interface is created. Right-click the export, select Add Interface from the context
menu and add an interface describing your interaction with a client. Generate the HTTP binding by selecting the
export and from the context menu selecting Generate Binding > HTTP Binding.
- The Configure HTTP Export Service dialog box opens.
- In the End-point configuration section, enter the context path. By default, it will be the module of your export. The context path is a relative URL address where the application project, <project name>Web, is the default context root.
In the Default data format field, select how the data will be serialized between the business object and the JMS message with a binding. To change the default, click Select beside the field to launch the Data Transformation Configuration window. Your selections are as follows:- Use a data format transformation in the binding registry. This list includes the prepackaged HTTP data format transformations. Selecting Show the deprecated data format transformations adds previous transformations that have been deprecated.
- Use a custom data format transformation you have created in your workspace
- Create a new data format transformation configuration.
In the Function selector section, select the function selector configuration you want to use. A function selector selects an operation to invoke on your component at runtime. Clicking Select beside the Function selector field, launches the Function Selector Configuration window and provides the following selections:- Use an existing function selector (default) lists the function selector configurations available. This list includes the prepackaged function selectors.
- Use a custom function selector that you have created in your workspace.
- Create a new function selector configuration.
Click OK. The HTTP binding is created and shown in the properties view when the Binding tab is selected. Sub tabs under the binding tab provide binding information details, which are discussed in the next steps. - In the Properties view, selecting the Binding tab displays the service level configuration properties, which can be edited. The context path, function selector configuration and data binding configuration are shown. A description of the binding may be added.
- Advanced configuration has the same tabs as described in the next step - HTTP Headers and HTTP Method Settings - but sets the values in these containers at the service level; that is, for the entire service. Method binding properties take precedence over these ones.
- Selecting Method bindings and the Generic tab displays the method level properties that can be edited. The properties list the context path and the native method, which will correspond to the operation name of the interface of the export. There is a field for a method binding description. Note that these properties only apply to the method level and changing them will only affect the method level, not the entire service. All method binding properties except the context path will be appended to the binding level context path to create a URL pointing to a specific method. All method level binding properties override the binding level properties.The Data Serialization tab lets you change the input and output data binding configuration.
Selecting the HTTP Headers tab lets you choose the transport and content encoding. Defaults are provided, but you can select different types of compression for the content and use chunking for an alternate transfer method. There are a range of media types and character sets that are displayed in drop-down lists. The HTTP 1.1 specification discusses these header fields in detail.
The HTTP Method Settings tab displays the HTTP methods available. GET is the default for a two-way operation and POST is the default for a one-way operation. The HTTP methods selectable are: DELETE, GET, HEAD, OPTIONS, POST, PUT, TRACE. These methods may be set as pingable and also contain a status code. 200, meaning the request sent by the client was successful, is the default status code. - Selecting the Faults configuration tab lets you configure the business fault data format for the faults in the interface. The configuration of faults is optional. The configuration can apply to all operations, a specific operation or a specific fault.If fault configuration is new to you, see Handling faults in bindings for an overview.
Click Select beside Business fault data format . Your selections are as follows:- Use a data format transformation in the binding registry. This list includes the prepackaged HTTP data format transformations.
- Use a custom data format transformation you have created in your workspace
- Create a new data format transformation configuration .
- The Propagation tab lets you select two types of context propagation. Context propagation takes information associated with a runtime or an application and passes it along with requests that are the result of interactions with that runtime or application. The default is to use runtime context propagation. See Propagation.
- The Summary tab displays the method that will be invoked on the export. The method name defaults to the operation name of the export interface. The endpoint URL address, which is the complete URL for the method, is formed from the application project, <project name>Web, interface name and operation name. When the URL specified is invoked, a method with the given name is invoked.
For training on IBM Lombardi mail us at [email protected]