uCosminexus Service Platform, Reception and Adapter Definition Guide
This section describes an example of setting up an HTTP reception for a business process executed in standard mode.
This subsection describes the system configuration and flow of processing in this setup example.
The following figure shows an example of the system configuration:
Figure F-1 Configuration of setup example (standard mode)
In this example, the operator uses a Web browser installed on the machine where the HCSC server environment is set up. This example uses a Web server incorporated into the J2EE server. The HTTP reception uses standard mode.
The flow of this setup example is as follows:
Header allocated variables are not used in this example. The setup procedure is described below.
Create the message formats used in the HTTP reception. The message format templates are stored in the following folder:
service-platform-installation-directory\CSC\custom-reception\http\schema |
Copy the entire folder to another location before editing the files it contains. Use the copied files as the basis when creating the message formats.
Create the message format to set in body allocated variables in the HTTP reception during reception. Create the message format by editing the template.
Edit the file urecp_http_body_detail_request.xsd.
Note: Do not edit urecp_http_body_request.xsd.
In this example, you add the elements shown in italics which represent kilometers per hour and hours traveled.
<?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="kilometers_per_hour" type=" xsd:positiveInteger "/>
<xsd:element name="hours" type=" xsd:positiveInteger "/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
|
HTTP reception header allocated variables are not used in this example.
Create the message format to set in body allocated variables in the HTTP reception when providing a response.
The message format below describes processing that returns the distance traveled. Create this format, and save it in the copied folder. The file name is urecp_http_body_response.xsd. Note that there is no template file for the response message (body) format.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="HTTPResponseBody ">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="distance" type=" xsd:positiveInteger "/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
|
To add an HTTP reception:
The following shows the information you need to set in the User-defined Reception Definition window. For details on the User-defined Reception Definition window, see 1.2.6 User-Defined Reception Definition Window in the manual Service Platform Reference Guide.
Enter the settings as shown in the table below.
Table F-1 Settings in the User Definition Reception window (basic) window
| Category | Item | Value to set | |
|---|---|---|---|
| User defined reception information | Reception name | HTTP Reception | |
| Reception ID | rcp1 | ||
| Reception type | Custom reception | ||
| Default operation name | calculateDistance | ||
| Operation | calculateDistance | ||
| Operation information | Operation name | calculateDistance | |
| Communication model | Sync | ||
| Request message (Body) | Use any type check box | Do not use (leave the check box cleared) | |
| Reception | Message format | urecp_http_body_request.xsd | |
| Service component | Use check box | Do not use (leave the check box cleared) | |
| Message format | -- | ||
| Data-conversion definition | -- | ||
| Response message (Body) | Use any type check box | Do not use (leave the check box cleared) | |
| Reception | Message format | urecp_http_body_response.xsd (the file you created in (2) Creating the message formats for the HTTP reception) | |
| Service component | Use check box | Do not use (leave the check box cleared) | |
| Message format | -- | ||
| Data-conversion definition | -- | ||
The following describes how to edit the HTTP Response Header definition file. Note that because header allocated variables are not used in the business process in this example, a description of the properties is omitted.
Connection=close extension-header=extension-header1 |
The following describes how to edit the HTTP reception definition file.
#urecp-http.context-root= #urecp-http.max-threads=10 #urecp-http.exclusive-threads=0 #urecp-http.queue-size=8192 #urecp-http.pooled-instance.minimum=0 #urecp-http.pooled-instance.maximum=0 #urecp-http.ejb-transaction-timeout=0 #httprecp.switchover.pass-through.mode=false httprecp.http.charset=UTF-8 httprecp.response.header.filename=cscurecphttp_header.properties #httprecp.system-exception.status-code=500 #httprecp.response.generate.content-length=true |
The following describes how to define the business process.
In this example, you create a business process in which a request message passed to an HTTP reception is transformed by a data transformation activity to generate a response message.
Arrange and connect the activities as shown in the following figure:
Figure F-2 Example of business process creation
For details on how to arrange and connect activities, see 5.4 Deploying and Linking Activities in the manual Service Platform Basic Development Guide.
Define the variables used in the business process.
The following table shows the variables to define:
| Variable name | Description |
|---|---|
| request_body | The request message (body) variable for the HTTP reception |
| response_body | The response message (body) variable for the HTTP reception |
Correlation sets are not used in this example.
The definition of these variables takes place in the Take In Message Format dialog box. To define these variables:
| Category | Item | Value to set |
|---|---|---|
| Service/Reception | Service name | -- |
| Reception name | HTTP Reception | |
| Target for take in | Operation name | calculateDistance |
| Message type | Request message (Body) | |
| Fault name | -- | |
| -- | Message format | request_body |
| Category | Item | Value to set |
|---|---|---|
| Service/Reception | Service name | -- |
| Reception name | HTTP Reception | |
| Target for take in | Operation name | calculateDistance |
| Message type | Response message (Body) | |
| Fault name | -- | |
| -- | Message format | response_body |
In the data transformation, a perform node operation function (calc1) determines the product of the two parameters in the request message, and maps the resulting value to the response message.
To define this data transformation:
The following describes how to set up the receive and reply activities.
| Item | Value to set |
|---|---|
| Activity name | Receive |
| Operation name | calculateDistance |
| Body allocated variable | request_body |
| Header allocated variable | -- |
| Correlation set group | -- |
| Communication model | Sync |
| Instance generation | Yes |
| Item | Value to set |
|---|---|
| Activity name | Reply |
| Operation name | calculateDistance |
| Body allocated variable | response_body |
| Header allocated variable | -- |
| Correlation set group | -- |
| Fault name | -- |
The following describes how to execute the business process you created.
Open your Web browser, and specify the URL below in the address bar. You can change the values in the query string as needed.
http://localhost/rcp1/calculateDistance?kilometers_per_hour=80&hours=25 |
The execution results are displayed in the Web browser, as shown in the following figure:
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.