uCosminexus Service Platform, Reception and Adapter Definition Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Glossary]](FIGURE/GLOSS.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
(1) Defining the file adapter
(a) Adding and validating the file adapter
To add and validate a file adapter:
- From the Eclipse menu, select Window, Show View, and then Other.
The Show View dialog box appears.
- Select HCSC-Definer and then HCSCTE View, and click OK.
The Service Definition List appears in the tree view.
- Right-click the Service Definition List in the tree view, and select Add Service Adapter.
The Service adapter definition addition wizard appears.
- From the Service component type: drop-down list, select File adapter.
- Click Next.
The Service adapter definition addition (File Adapter) wizard appears.
- Enter the service name.
Enter CSAFF_SAMPLE_READ_CSV as the service name.
- Click Finish.
The necessary files are created, and stored in the repository. The Service adapter definition (standard) window appears.
- Enter settings in the Service adapter definition (standard) and Service adapter definition (details) windows.
For details on the settings you need to enter, see File adapter settings (sample for reading CSV data).
- Review the definition contents, and then save file adapter settings by selecting File and then Save from the Eclipse menu.
- Verify the file adapter settings.
Select Verify from the pop-up list displayed when you right-click the Service Definition List in the tree view. The results of the validation process appear in Console View.
- File adapter settings (sample for reading CSV data)
- The table below shows the items you need to set in the Service adapter definition (standard) window when defining the file adapter for the sample for reading CSV data. You do not need to set items that do not appear in this table.
Table D-20 Settings in Service adapter definition (standard) window (sample for reading CSV data)
| Category |
Item |
Value to set |
Requires setting |
| Service component control information |
Service name |
CSAFF_SAMPLE_READ_CSV |
Y |
| Service ID |
CSAFF_RC |
Y |
| Service type |
File adapter |
N |
| Maximum instances |
0 |
Y |
| Operation |
Pattern: Binary file reading
Operation name: CSAFF_SAMPLE_READ_CSV |
Y |
| Operation information |
Operation name |
CSAFF_SAMPLE_READ_CSV |
N |
| Communication model |
Sync |
Y |
| Request message |
Standard |
Use check box |
Do not use (leave the check box cleared) |
Y |
| Service component |
Format ID |
SAMPLE_READ_CSV_Request |
Y |
| Message format |
adpff_read.xsd |
N |
| Response message |
Standard |
Use check box |
Select this check box. |
Y |
| Format ID |
SAMPLE_READ_CSV_Standard |
Y |
| Message format |
csaff_sample_read_csv_standard.xsd |
Y |
| Service component |
Format ID |
SAMPLE_READ_CSV_Response |
Y |
| Message format |
csaff_sample_read_csv.fdx |
Y |
| Data TransDefn File |
SAMPLE_READ_CSV_DT |
Y |
- Legend:
- Y: Must be set.
- N: Check the content that is already displayed.
The table below shows the items you need to set in the Service adapter definition (details) window when defining the file adapter for the sample for reading CSV data. You do not need to set items that do not appear in this table.
Table D-21 Settings in Service adapter definition (details) window (sample for reading CSV data)
| Category |
Item |
Value to set |
Requires setting |
| Service adapter control information |
Service adapter (EJB-JAR file) |
cscmsg_adpejb.jar |
N |
| Utility class (JAR file) |
adpffpc.jar |
N |
- Legend:
- N: Check the content that is already displayed.
(b) Defining data transformation
Set the data transformation definition. The following figure shows the data transformation definition you need to set:
Figure D-5 Data-conversion definition screen for file adapter (sample for reading CSV data)
![[Figure]](FIGURE/ZS05030A.GIF)
To define this data transformation:
- Display the data transformation (mapping) definition screen in the Adapter Definition screen.
After displaying the data transformation (mapping) definition screen, the Select Root Element dialog box appears.
- Select the root elements for all logical schema names.
The OK button becomes available.
- Click OK.
The schemas of the selected root elements appear in tree format in the transformation-source schema tree viewer and the transformation-destination schema tree viewer.
- Perform mapping.
Mapping involves the following tasks:
- Placing and setting functions
The following table shows the function settings:
Table D-22 Function settings (sample for reading CSV data - File adapter)
| Function |
Function name |
Value to set |
| loop |
loop1 |
Select Node |
csaff_sample_read_csv_data |
| Set Node Condition |
See table below |
Table D-23 Settings for loop1
| Category |
Value to set |
| Node |
csaff_sample_read_csv_data |
| Condition |
Condition |
Condition format |
| Left side |
Node or function (PRODUCT_CODE) |
| Operation |
= |
| Right side |
Value: 1001 |
- Setting inter-node mapping
The following table shows the inter-node mapping settings:
Table D-24 Mapping settings (sample for reading CSV data - File adapter)
| Source node |
Function |
Target node |
| -- |
loop1 |
DATA |
| ORDER_NO |
-- |
ORDER_NO |
| CUSTOMER_CODE |
-- |
CUSTOMER_CODE |
| PRODUCT_CODE |
-- |
PRODUCT_CODE |
| ORDER_COUNT |
-- |
ORDER_COUNT |
- Legend:
- --: Not applicable.
- In the data transformation (mapping) definition screen, right-click an appropriate location in the transformation-source schema tree viewer, transformation-destination schema tree viewer, or mapping viewer, and select Validate.
Validation takes place.
(c) Creating the file adapter runtime-environment property file
To create the file adapter runtime-environment property file:
- Open the sample file adapter runtime-environment property file in a text editor.
The sample file adapter runtime-environment property file is service-platform-installation-directory\CSC\custom-adapter\File\sample\read_csv\CSAFF_RC.properties.
- Add the following content to the file:
fileaccess.path1 = service-platform-installation-directory\\CSC\\custom-adapter\\File\\sample\\read_csv
- Note
- Use \\ as the delimiting characters between directories.
- Save the file in the following directory: service-platform-installation-directory\CSC\custom-adapter\File\config
(2) Defining the business process
The task of defining a business process involves adding a business process, defining the contents of the business process, and then validating the business process.
(a) Adding a business process
To add a business process:
- From the Eclipse menu, select Window, Show View, and then Other.
The Show View dialog box appears.
- Select HCSC-Definer and then HCSCTE View, and click OK.
The Service Definition List appears in the tree view.
- Right-click the Service Definition List in the tree view, and select Add Business Process.
A dialog box appears in which you can add a business process definition.
- Enter the name of the business process, and select whether to make its status persistent (whether to save the execution status of the business process in the database).
Enter CSAFF_SAMPLE_BP_READ_CSV as the business process name.
Select yes for Status Persistence.
- Reference note
- Do not use a BPEL file.
- Click Finish.
The necessary files are created, and stored in the repository. The Define Business Process window appears.
(b) Setting variables
Set the following variables:
- CSAFF_DB_RequestMessage
- CSAFF_DB_ResponseMessage
- CSAFF_RequestMessage
- CSAFF_ResponseMessage
- Reference note
- The sample business process does not use a correlation set.
To set the variables:
- Double-click the Variable-Correlation icon on the canvas of the Define Business Process window.
The List Of Variables And Correlation Sets dialog box appears.
- Select Variable List from the list.
- Enter the variable name.
- From the Type: drop-down list, select XML.
- Perform whichever of the following operations is relevant for the variable you are defining:
- For CSAFF_DB_ResponseMessage, CSAFF_RequestMessage, and CSAFF_ResponseMessage
- In the Take In Message Format dialog box displayed by clicking the Take In button, specify the message format you want to use. For details on the settings you need to enter, see Variable settings (sample for reading CSV data).
- For CSAFF_DB_RequestMessage
- Click the ... button and select the csaff_sample_read_csv_dt.xsd file.
- Click Add.
The variable you added appears in the list of variables.
- Repeat steps 2 to 6 for each variable.
- Click OK.
The variable settings are saved and the List Of Variables And Correlation Sets dialog box closes.
- Variable settings (sample for reading CSV data)
- The tables below show the settings for the CSAFF_DB_ResponseMessage, CSAFF_RequestMessage, and CSAFF_ResponseMessage variables. You do not need to set items that do not appear in this table.
Table D-25 Settings for CSAFF_DB_ResponseMessage (sample for reading CSV data)
| Category |
Item |
Value to set |
| Service/Reception |
Service name |
CSAFF_SAMPLE_DB |
| Reception name |
-- |
| Target for take in |
Operation name |
CSAFF_SAMPLE_DB |
| Message type |
Response message (Body) |
| -- |
Message format |
csaff_sample_sqlformat |
- Legend:
- --: Not applicable.
Table D-26 Settings for CSAFF_RequestMessage (sample for reading CSV data)
| Category |
Item |
Value to set |
| Service/Reception |
Service name |
CSAFF_SAMPLE_READ_CSV |
| Reception name |
-- |
| Target for take in |
Operation name |
CSAFF_SAMPLE_READ_CSV |
| Message type |
Request message (Body) |
| -- |
Message format |
adpff_read |
- Legend:
- --: Not applicable.
Table D-27 Settings for CSAFF_ResponseMessage (sample for reading CSV data)
| Category |
Item |
Value to set |
| Service/Reception |
Service name |
CSAFF_SAMPLE_READ_CSV |
| Reception name |
-- |
| Target for take in |
Operation name |
CSAFF_SAMPLE_READ_CSV |
| Message type |
Response message (Body) |
| -- |
Message format |
csaff_sample_standard |
- Legend:
- --: Not applicable.
(c) Setting up activities
The following describes how to arrange and define the activities in the following figure, define the data transformations, and connect the activities.
Figure D-6 Overall view of business process definition (sample for reading CSV data)
![[Figure]](FIGURE/ZS05040A.GIF)
Arranging and defining activities
In the sample for reading CSV data, set up the activities shown in the following table.
Table D-28 List of activities (sample for reading CSV data)
| Activity |
Activity name |
Description |
| Reception |
CSAFF_SAMPLE_BP_READ_CSV |
Receives messages into the business process. |
| Response |
CSAFF_SAMPLE_BP_READ_CSV_RSP |
Issues a response from the business process. |
| Service invocation |
InvokeFileAadapter |
Invokes the file adapter. |
| Service invocation |
InvokeDBAdapter |
Invokes the DB adapter. |
| Data transformation |
CreateDBAdapterRequestMessage |
Transforms a response message from the file adapter to a request message for the DB adapter. |
To position and set up an activity:
- In the palette, click the basic or structure activity you want to place on the canvas.
The activity you clicked is selected.
- Click the appropriate location on the canvas.
The selected activity is placed on the canvas. You can reposition the activity by dragging it with your mouse.
- Double-click the activity on the canvas.
A dialog box appears in which you can enter settings for the activity you double-clicked.
- Enter the necessary information in the dialog box.
For details on the information you need to set, see Activity settings (sample for reading CSV data).
- Click OK.
The dialog box for the activity closes.
- Repeat steps 1 to 5 for each activity.
- Activity settings (sample for reading CSV data)
- The tables below show the settings for the business process activities used in the sample for reading CSV data. You do not need to set items that do not appear in this table.
Table D-29 Settings for CSAFF_SAMPLE_BP_READ_CSV
| Item |
Value to set |
| Activity name |
CSAFF_SAMPLE_BP_READ_CSV |
| Operation name |
CSAFF_SAMPLE_BP_READ_CSV |
| Body allocated variable |
CSAFF_RequestMessage |
| Communication model |
Sync |
| Instance generation |
Yes |
Table D-30 Settings for CSAFF_SAMPLE_BP_READ_CSV_RSP
| Item |
Value to set |
| Activity name |
CSAFF_SAMPLE_BP_READ_CSV_RSP |
| Operation name |
CSAFF_SAMPLE_BP_READ_CSV |
| Body allocated variable |
CSAFF_DB_ResponseMessage |
Table D-31 Settings for InvokeFileAadapter (sample for reading CSV data)
| Item |
Value to set |
| Activity name |
InvokeFileAadapter |
| Service name |
CSAFF_SAMPLE_READ_CSV |
| Operation name |
CSAFF_SAMPLE_READ_CSV |
| Communication model |
Sync |
| Request message |
Body allocated variable |
CSAFF_RequestMessage |
| Response message |
Body allocated variable |
CSAFF_ResponseMessage |
Table D-32 Settings for InvokeDBAdapter (sample for reading CSV data)
| Item |
Value to set |
| Activity name |
InvokeDBAdapter |
| Service name |
CSAFF_SAMPLE_DB |
| Operation name |
CSAFF_SAMPLE_DB |
| Communication model |
Sync |
| Request message |
Body allocated variable |
CSAFF_DB_RequestMessage |
| Response message |
Body allocated variable |
CSAFF_DB_ResponseMessage |
Table D-33 Settings for CreateDBAdapterRequestMessage (sample for reading CSV data)
| Item |
Value to set |
| Activity name |
CreateDBAdapterRequestMessage |
| Source Variables |
CSAFF_ResponseMessage |
| Destination Variable |
CSAFF_DB_RequestMessage |
| Data TransDefn File |
SAMPLE_READ_CSV_DT |
Setting the data transformation definition for the CreateDBAdapterRequestMessage activity
Set the data transformation definition for the CreateDBAdapterRequestMessage activity. The following figure shows the data transformation definition you need to set:
Figure D-7 Data conversion definition window for CreateDBAdapterRequestMessage activity (sample for reading CSV data)
![[Figure]](FIGURE/ZS050500.GIF)
To set the data transformation definition for the CreateDBAdapterRequestMessage activity:
- Display the data transformation (mapping) definition screen from the CreateDBAdapterRequestMessage activity.
After displaying the data transformation (mapping) definition screen, the Select Root Element dialog box appears.
- Select the root elements for all logical schema names.
The OK button becomes available.
- Click OK.
The schemas of the selected root elements appear in tree format in the transformation-source schema tree viewer and the transformation-destination schema tree viewer.
- Perform mapping.
Mapping involves the following tasks:
- In the data transformation (mapping) definition screen, right-click an appropriate location in the transformation-source schema tree viewer, transformation-destination schema tree viewer, or mapping viewer, and select Validate.
Validation takes place. You can ignore any warning messages that appear.
Connecting activities
In the sample business process for reading CSV data, connect the activities as shown in the following table.
Table D-36 Activity connections (sample for reading CSV data)
| Connection-source activity |
Connection-target activity |
| Start |
CSAFF_SAMPLE_BP_READ_CSV |
| CSAFF_SAMPLE_BP_READ_CSV |
InvokeFileAadapter |
| InvokeFileAadapter |
CreateDBAdapterRequestMessage |
| CreateDBAdapterRequestMessage |
InvokeDBAdapter |
| InvokeDBAdapter |
CSAFF_SAMPLE_BP_READ_CSV_RSP |
| CSAFF_SAMPLE_BP_READ_CSV_RSP |
Finish |
To connect the activities:
- On the palette, click Connection.
Connection mode is selected.
When you align your cursor with an activity that can be specified as a connection source, the background color of the activity changes.
- On the canvas, click the activity that you want to serve as the connection source.
The activity is set as the connection source.
If you then align your cursor with another activity, the background color of the activity changes if it can be specified as a connection target.
- On the canvas, click the activity that you want to serve as the connection target.
The activity you selected as the connection source is connected to the activity you selected as the connection target.
(d) Saving and validating the business process
To save and validate the business process:
- Review the definition contents, and then save the business process definition by selecting File and then Save from the Eclipse menu.
In properties view, set CSAFF_B2 as the service ID of the business process.
- Validate the business process settings.
Select Verify from the pop-up list displayed when you right-click the Service Definition List in the tree view. The results of the validation process appear in Console View.
(3) Distributing the file adapter and business process deployment definitions
Deploy the file adapter and business process and start them on the server.
To distribute the file adapter and business process deployment definitions:
- Right-click the Service Definition List in the tree view, and select Deploy all services to server and start.
If the file adapter or business process fails to start, a dialog box appears describing the nature of the error. Look up the message ID displayed in the error details and take the appropriate action.
If you are not logged in, the Account Verification window appears. In this case, perform step 2.
- 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.
(4) Creating tables
Create the table the sample business process will access in the database.
Open HiRDB SQL Executer and execute the following SQL statement:
CREATE TABLE CSAFF_SAMPLE_RC
(ORDER_NO INT,
CUSTOMER_CODE CHAR(5),
PRODUCT_CODE CHAR(4),
ORDER_COUNT INT);
- Note
- Use ADMIN as the user ID.
(5) Creating request messages
The following describes how to create a request message by editing the sample request message used when executing the business process.
- Open the sample request message file in a text editor.
The sample request message file is service-platform-installation-directory\CSC\custom-adapter\File\sample\read_csv\read_csv_message.xml.
- Add the part in italics below:
<?xml version="1.0" encoding="UTF-8"?>
<adpff:ReadRequest xmlns:adpff="http://FlatFiles.cstmadp.csc.soft.Hitachi.co.jp/ReadRequest">
<fileheader>
<filename>service-platform-installation-directory\CSC\custom-adapter\File\sample\read_csv\read_csv_data.csv</filename>
<filemode>all</filemode>
</fileheader>
</adpff:ReadRequest>
- Save the file.
(6) Executing the business process
To execute the sample, start the business process from the service requester.
The flow of service requester processing is as follows:
- Service requester execution
The request message of the business process is used as the request message of the file adapter without transformation.
- File adapter execution
The file specified in the request message is read.
- DB adapter message creation
The response message from the file adapter is transformed to a request message for the DB adapter.
- DB adapter execution
The file specified in the request message is registered in the database.
- Service requester termination
The response message from the DB adapter is used as the response message of the business process without transformation.
To execute the service requester:
- Navigate to service-platform-installation-directory\CSC\custom-adapter\File\sample\bin.
- Execute request.bat.
Execute request.bat in the following format:
request read_csv service-platform-installation-directory\CSC\custom-adapter\File\sample\read_csv\read_csv_message.xml
- Reference note
- You can check the contents of the table by starting HiRDB SQL Executer and executing the following SQL statement (using ADMIN as the user ID):
- SELECT * FROM CSAFF_SAMPLE_RC;
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.