uCosminexus Service Platform, Reception and Adapter Definition Guide

[Contents][Glossary][Index][Back][Next]

Appendix G.2 Setup example 2 (dynamically changing the connection destination of the HTTP adapter for each request)

Organization of this subsection
(1) Overview of setup example
(2) Creating the message format
(3) Changing the variable definition
(4) Changing the data transformation definition
(5) Preparing to execute the business process
(6) Executing the business process

(1) Overview of setup example

This setup example involves modifying the definitions you created in G.1 Setup example 1 (downloading the file from the HTTP server to the HTTP client) to define a business process that dynamically changes the connection destination path of the HTTP adapter according to the nature of the request.

A query passed to the HTTP reception provides the input data used to dynamically change the connection destination.

You must have completed the steps in G.1 Setup example 1 (downloading the file from the HTTP server to the HTTP client) from beginning to end before performing the steps in this setup example.

(a) Environment configuration

The following figure shows an example of the environment created in this setup example:

Figure G-2 Environment configuration created in setup example 1

[Figure]

This setup example describes the procedure for changing the definition of the elements in the box with the dashed border in the figure.

As in setup example 1, a requirement for this setup example is that the HTTP servers to which the HTTP adapter will connect are set up in advance. In setup example 2, the HTTP server must be configured so that the HTTP adapter can download test2.bmp by accessing http://hostA:80/test2.bmp.

(b) Flow of setup procedure

The setup procedure consists of the following steps:

  1. Creating the message format
  2. Changing the variable definition
  3. Changing the data transformation definition
  4. Preparing to execute the business process
  5. Executing the business process

Each step is described in detail below.

(2) Creating the message format

Create the message format to use as the request message (body) of the HTTP reception. The query information passed from the HTTP client is stored in the message format you created.

Use the template to create the message format. To create the message format using the template:

  1. Copy the following folder containing the message format template to a location of your choice:
    service-platform-installation-directory\CSC\custom-reception\http\schema
  2. Open the urecp_http_body_detail_request.xsd file in the folder in a text editor.
  3. Add the element shown in italics which represents the file name.
     
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema elementFormDefault="qualified"
     targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/reception/http/request"
     xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/reception/http/request"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:complexType name="http-body-requestType">
      <xsd:sequence>
       <!-- User Customize -->
       <xsd:element name="filename" type="xsd:string"/>
      </xsd:sequence>
     </xsd:complexType>
    </xsd:schema>
     
  4. Save the file.
    Note: Do not edit urecp_http_body_request.xsd.

(3) Changing the variable definition

(a) HTTP reception

Apply the message format you created in (2) to the HTTP reception definition.

  1. In the tree in the service definition list, double-click the HTTP reception (recphttp).
    The User-defined Reception Definition window for the HTTP reception appears.
  2. In the Request message area, click the Browse button beside the Message format field in the Reception area, and specify the following format definition file:
    copy-destination-folder-in(2)\schema\urecp_http_body_request.xsd

    [Figure]

  3. Save the HTTP reception by selecting Save from the File menu.
    If the following confirmation dialog box appears when you attempt to save the HTTP reception, click OK:

    [Figure]

(b) Business process

Update the body allocated variable recphttp_body_request for the HTTP reception request message to reflect the message format you created in (2).

  1. In the service definition list in the tree view, double-click the business process (bp1).
    The Define Business Process window appears.
  2. On the canvas of the Define Business Process window, double-click the Variable-Correlation icon.
    The List Of Variables And Correlation Sets dialog box appears.
  3. In the variable list tree, select recphttp_body_request and click Take In.
    The Take In Message Format dialog box appears.
  4. Specify the following information, and then click OK:
    Variable name Service/Reception Operation name Message type Message format
    recphttp_body_request Reception name recphttp get Request message (Body) recphttp_body_request.xsd

    [Figure]

  5. In the List Of Variables And Correlation Sets dialog box, click Update.
    The variable is updated.
  6. In the List Of Variables And Correlation Sets dialog box, click Show Tree.
    The Showing Variable dialog box appears.

    [Figure]

    Make sure that the variable has been updated, and close the dialog box.
  7. In the List Of Variables And Correlation Sets dialog box, click OK.
    The List Of Variables And Correlation Sets dialog box closes.

(4) Changing the data transformation definition

Use the request message (body) variable for the HTTP reception to change the mapping definition.

(a) Mapping to HTTP adapter body request message
  1. Double-click the data transformation activity (CreateHTTPAdapterBodyRequestMessage) in the Define Business Process window.
  2. A dialog box appears in which you can confirm the launch of the mapping definition editor.

    [Figure]

  3. Click OK.
    The Mapping Definition window appears.

    [Figure]

The filename element has been added as a mapping source. As in setup example 1, you do not need to configure mapping for this element.

(b) Mapping to HTTP adapter header request message
  1. Right-click the data transformation activity (CreateHTTPAdapterHeaderRequestMessage) in the Define Business Process window, and then click Setting.
    The Data Transformation Activity dialog box appears.
  2. Select recphttp_body_request from the Variable drop-down list in the Source Variables area, and then click Add.
    The recphttp_body_request variable is added to the list.

    [Figure]

  3. Click OK.
    The Data Transformation Activity dialog box closes.
  4. Double-click the data transformation activity (CreateHTTPAdapterHeaderRequestMessage).
    A dialog box appears in which you can confirm the launch of the mapping definition editor.
  5. Click OK.
    The Select Root Element dialog box appears.

    [Figure]

  6. Click OK.
    The Mapping Definition window appears.
    The recphttp_body_request variable now appears as a mapping source.

    [Figure]

    You can then use the filename element of recphttp_body_request to define mapping that changes the name of the file acquired by the HTTP adapter from the value set in the HTTP-adapter runtime-environment property file.
  7. Place the const function on the canvas, and then double-click it.
    The Set Constant dialog box appears.
  8. Select String, and in Value, specify /.

    [Figure]

  9. Click OK.
    The Set Constant dialog box closes.
  10. Place the concat function on the canvas.
  11. Set up mapping with reference to the table below.
    Take care to ensure that the elements are mapped in the correct sequence. The paths of the mapping sources and targets are paths from the root element.
    No. Mapping source Mapping target
    1 const function concat function
    2 /hrc:http-body-request/hrc:parameter/hrc:filename concat function
    3 concat function /tns:http-header-request/tns:uri-path

    [Figure]

(5) Preparing to execute the business process

Define deployment of the HCSC component you defined. To deploy the HCSC component:

  1. From the File menu, select Save All.
    The definitions of the HTTP adapter, HTTP reception, and business process are saved.
  2. Right-click the Service Definition List in the tree view, and select Deploy all services to server and start.
    If you are not logged in, the Account Verification window appears. In this case, perform step 3.
  3. Enter admin in the User ID field and the Password field, and then click OK.
    A message indicating that account verification is in progress appears, followed by a message indicating whether it was successful.

If the following dialog box appears, the deployment process was successful.

[Figure]

If the process failed, read the error message and make sure that the information you have defined is correct.

(6) Executing the business process

  1. Open your Web browser, and access the following URL:
    http://hostB/rcp1/get?filename=test2.bmp
    As hostB, specify a value that will resolve to the IPv4-format IP address of host B. The elements following the host name are the reception ID and the name of the reception operation. In the query, specify the filename parameter you defined.

If the business process was executed correctly, you can download the file from the HTTP reception. In this case, the dialog box appears in your Web browser:

Note:
Because the file name of the downloaded file is set statically in G.1(9)(c) CreateHTTPReceptionBodyResponseMessage, the name of the downloaded file will be test.bmp as in setup example 1.

Based on the execution results of setup example 2, confirm that the connection-destination path set in the HTTP-adapter runtime-environment property file has been replaced with the request message (header) of the HTTP adapter.

Reference note
If you want to make sure that different files are being downloaded, download the file of setup example 1 by accessing the following URL with the parameter changed:
http://hostB/rcp1/get?filename=test.bmp