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_WRITE_XML 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 writing XML data).
- Review the definition contents, and then save the service adapter definition 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 writing XML 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 writing XML data. You do not need to set items that do not appear in this table.
Table D-38 Settings in Service adapter definition (standard) window (sample for writing XML data)
| Category |
Item |
Value to set |
Requires setting |
| Service component control information |
Service name |
CSAFF_SAMPLE_WRITE_XML |
Y |
| Service ID |
CSAFF_WX |
Y |
| Service type |
File adapter |
N |
| Maximum instances |
0 |
Y |
| Operation |
Pattern: XML file writing
Operation name: CSAFF_SAMPLE_WRITE_XML |
Y |
| Operation information |
Operation name |
CSAFF_SAMPLE_WRITE_XML |
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_WRITE_XML_Request |
Y |
| Message format |
csaff_sample_write_xml_dt.xsd |
Y |
| Response message |
Standard |
Use check box |
Do not use (leave the check box cleared) |
Y |
| Service component |
Format ID |
SAMPLE_WRITE_XML_Response |
Y |
| Message format |
adpff_result.xsd |
N |
- 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 writing XML data. You do not need to set items that do not appear in this table.
Table D-39 Settings in Service adapter definition (details) window (sample for writing XML 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) 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\write_xml\CSAFF_WX.propertie.
- Add the following content to the file:
fileaccess.path1 = service-platform-installation-directory\\CSC\\custom-adapter\\File\\sample\\write_xml
- 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_WRITE_XML 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_BP_RequestMessage
- 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:
- 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.
- 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 writing XML data).
- For CSAFF_BP_RequestMessage
- Click the ... button and select the csaff_sample_write_xml.xsd file.
- For CSAFF_DB_RequestMessage
- Click the ... button and select the csaff_sample_write_xml_db.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 writing XML 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-40 Settings for CSAFF_DB_ResponseMessage (sample for writing XML 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-41 Settings for CSAFF_RequestMessage (sample for writing XML data)
| Category |
Item |
Value to set |
| Service/Reception |
Service name |
CSAFF_SAMPLE_WRITE_XML |
| Reception name |
-- |
| Target for take in |
Operation name |
CSAFF_SAMPLE_WRITE_XML |
| Message type |
Request message (Body) |
| -- |
Message format |
csaff_sample_write_xml_dt |
- Legend:
- --: Not applicable.
Table D-42 Settings for CSAFF_ResponseMessage (sample for writing XML data)
| Category |
Item |
Value to set |
| Service/Reception |
Service name |
CSAFF_SAMPLE_WRITE_XML |
| Reception name |
-- |
| Target for take in |
Operation name |
CSAFF_SAMPLE_WRITE_XML |
| Message type |
Response message (Body) |
| -- |
Message format |
adpff_result |
- Legend:
- --: Not applicable.
(c) Setting up activities
The following describes how to arrange and define the activities in the figure below, define the data transformations, and connect the activities.
Figure D-8 Overall view of business process definition (sample for writing XML data)
![[Figure]](FIGURE/ZS050600.GIF)
Arranging and defining activities
In the sample for writing XML data, set up the activities shown in the following table.
Table D-43 List of activities (sample for writing XML data)
| Activity |
Activity name |
Description |
| Reception |
CSAFF_SAMPLE_BP_WRITE_XML |
Receives messages into the business process. |
| Reply |
CSAFF_SAMPLE_BP_WRITE_XML_RSP |
Issues a response from the business process. |
| Invoke Service |
InvokeFileAadapter |
Invokes the file adapter. |
| Invoke Service |
InvokeDBAdapter |
Invokes the DB adapter. |
| Data transformation |
CreateFileAdapterRequestMessage |
Transforms a response message from the DB adapter to a request message for the file adapter. |
| Data transformation |
CreateDBAdapterRequestMessage |
Transforms the request message of the business process 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 writing XML data).
- Click OK.
The dialog box for the activity closes.
- Repeat steps 1 to 5 for each activity.
- Activity settings (sample for writing XML data)
- The tables below show the settings for the business process activities used in the sample for writing XML data. You do not need to set items that do not appear in this table.
Table D-44 Settings for CSAFF_SAMPLE_BP_WRITE_XML
| Item |
Value to set |
| Activity name |
CSAFF_SAMPLE_BP_WRITE_XML |
| Operation name |
CSAFF_SAMPLE_BP_WRITE_XML |
| Body allocated variable |
CSAFF_BP_RequestMessage |
| Communication model |
Sync |
| Instance generation |
Yes |
Table D-45 Settings for CSAFF_SAMPLE_BP_WRITE_XML_RSP
| Item |
Value to set |
| Activity name |
CSAFF_SAMPLE_BP_WRITE_XML_RSP |
| Operation name |
CSAFF_SAMPLE_BP_WRITE_XML |
| Body allocated variable |
CSAFF_ResponseMessage |
Table D-46 Settings for InvokeFileAadapter (sample for writing XML data)
| Item |
Value to set |
| Activity name |
InvokeFileAadapter |
| Service name |
CSAFF_SAMPLE_WRITE_XML |
| Operation name |
CSAFF_SAMPLE_WRITE_XML |
| Communication model |
Sync |
| Request message |
Body allocated variable |
CSAFF_RequestMessage |
| Response message |
Body allocated variable |
CSAFF_ResponseMessage |
Table D-47 Settings for InvokeDBAdapter (sample for writing XML 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-48 Settings for CreateFileAdapterRequestMessage (sample for writing XML data)
| Item |
Value to set |
| Activity name |
CreateFileAdapterRequestMessage |
| Source Variables |
CSAFF_BP_RequestMessage |
| CSAFF_DB_ResponseMessage |
| Destination Variable |
CSAFF_RequestMessage |
| Data TransDefn File |
SAMPLE_WRITE_XML_DT2 |
Table D-49 Settings for CreateDBAdapterRequestMessage (sample for writing XML data)
| Item |
Value to set |
| Activity name |
CreateDBAdapterRequestMessage |
| Source Variables |
CSAFF_BP_RequestMessage |
| Destination Variable |
CSAFF_DB_RequestMessage |
| Data TransDefn File |
SAMPLE_WRITE_XML_DT1 |
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-9 Data conversion definition window for CreateDBAdapterRequestMessage activity (sample for writing XML data)
![[Figure]](FIGURE/ZS050700.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.
Setting the data transformation definition for the CreateFileAdapterRequestMessage activity
Set the data transformation definition for the CreateFileAdapterRequestMessage activity. The following figure shows the data transformation definition you need to set:
Figure D-10 Data conversion definition window for CreateFileAdapterRequestMessage activity (sample for writing XML data)
![[Figure]](FIGURE/ZS050800.GIF)
To set the data transformation definition for the CreateFileAdapterRequestMessage activity:
- Display the data transformation (mapping) definition screen from the CreateFileAdapterRequestMessage 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:
- Placing and setting functions
The following table shows the function settings:
Table D-52 Function settings (sample for writing XML data - CreateFileAdapterRequestMessage activity)
| Function |
Function name |
Value to set |
| loop |
loop1 |
Select Node |
DBA_ResultSet# |
| Set Node Condition |
Do not set |
| loop |
loop2 |
Select Node |
DBA_ResultColumn# |
| Set Node Condition |
Do not set |
- #
- DBA_ResultSet and DBA_ResultColumn use the information under the WRITE_XML node.
- Setting inter-node mapping
The following table shows the inter-node mapping settings:
Table D-53 Mapping settings (sample for writing XML data - CreateFileAdapterRequestMessage activity)
| Source node |
Function |
Target node |
| -- |
loop1 |
record |
| -- |
loop2 |
column |
| filename |
-- |
filename |
| filemode |
-- |
filemode |
| DBA_ResultColumn# |
-- |
data |
- Legend:
- --: Not applicable.
- #
- DBA_ResultColumn uses information under the WRITE_XML node.
- 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 for writing XML data, connect the activities as shown in the following table.
Table D-54 Activity connections (sample for writing XML data)
| Connection-source activity |
Connection-target activity |
| Start |
CSAFF_SAMPLE_BP_WRITE_XML |
| CSAFF_SAMPLE_BP_WRITE_XML |
CreateDBAdapterRequestMessage |
| CreateDBAdapterRequestMessage |
InvokeDBAdapter |
| InvokeDBAdapter |
CreateFileAdapterRequestMessage |
| CreateFileAdapterRequestMessage |
InvokeFileAadapter |
| InvokeFileAadapter |
CSAFF_SAMPLE_BP_WRITE_XML_RSP |
| CSAFF_SAMPLE_BP_WRITE_XML_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 file adapter settings by selecting File and then Save from the Eclipse menu.
In properties view, set CSAFF_B4 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_WX
(ORDER_NO INT,
CUSTOMER_CODE CHAR(5),
PRODUCT_CODE CHAR(4),
ORDER_COUNT INT);
INSERT INTO CSAFF_SAMPLE_WX VALUES(1001,'AA001','1001',5);
INSERT INTO CSAFF_SAMPLE_WX VALUES(1002,'AB002','1001',1);
INSERT INTO CSAFF_SAMPLE_WX VALUES(1003,'AA001','1102',3);
INSERT INTO CSAFF_SAMPLE_WX VALUES(1004,'XA005','1103',1);
INSERT INTO CSAFF_SAMPLE_WX VALUES(1005,'AA001','1105',1);
- 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\write_xml\write_xml_message.xml.
- Add the part in italics below:
<?xml version="1.0" encoding="UTF-8"?>
<WriteData>
<filename>service-platform-installation-directory\CSC\custom-adapter\File\sample\write_xml\write_xml_data.xml</filename>
<filemode>new</filemode>
<PRODUCT_CODE>1001</PRODUCT_CODE>
</WriteData>
- 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.
- DB adapter execution
Data that matches the conditions specified in the request message is acquired from the database.
- Create file adapter message
The response message from the DB adapter is transformed to a request message for the file adapter.
- File adapter execution
The file specified in the request message is output.
- Service requester termination
The response message from the file adapter is used without transformation as the response message of the business process.
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 write_xml service-platform-installation-directory\CSC\custom-adapter\File\sample\write_xml\write_xml_message.xml
- Reference note
- The data is output to the following file:
- service-platform-installation-directory\CSC\custom-adapter\File\sample\write_xml\write_xml_data.xml
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.