Co-publisher: @Suman Yadav
In this article, we will talk about the two-scenario listed below:
- How to create and connect App Connect TCP/IP client and TCP/IP server on CP4I and message communication between them.
- How to create and connect App Connect TCP/IP client running on CP4I to the TCP/IP Server running outside CP4I and message communication between them.
How the flow works:
Within the TCPIPServer application, a message flow named TCPIPProvider.msgflow receives the XML message through an HTTPInput node. The message is parsed and passed to the TCPIPServerOutput node to send the data to the client connected on port 7787. The TCPIPServerOutput node is configured by using the policy TCPIPTutorialServer. Trace nodes, embedded in both the message flows help to track the journey of the data between the flows using a common trace file.
The TCPIPClient application contains a message flow called TCPIPReceiver.msgflow, which uses the TCPIPClientInput node to receive the data from the server. The TCPIPClientInput node is configured with the policy TCPIPTutorialClient that specifies the host, the port, and the minimum number of client connections that are automatically opened. This message flow also contains a Mapping node that uses nested maps to transform the message data into a different format. Finally, the message is written to a file through the FileOutput node.
Scenario 1: How to create and connect App Connect TCP/IP client and TCP/IP server on CP4I and message communication between them.
TCPIP Server flow:
Server policy:
TCP_Server bar:
TCP_Server bar contains Server application, server policy and data library:
TCPIP Client Flow:
Client policy:
In the below policy hostname is the servicename of TCPIPServer Integrationserver. How to create this servicename is explained later in this blog(See Steps 7 to 11 below).
TCP_Client bar:
TCP_Client bar contains Client application, client policy and data library:
Create TCPIPServer Integration Server on CP4I
1. Click on Create Server:
2. Select your TCP_Server.bar
3. Click on Create configuration:
4. Select Type as “Policy project”, provide name and select server policy and click on create:
5. Click on Next:
6. Enter Integration Server name:
7. Click on Advanced settings and click on Service. Then provide name and port (port should be same as the port number which we used in the policies) & click on Create:
8. Integration Server is created:
9. Open the pods and click on newly created pod and open the tab “Logs” and confirm Integration server is started without any errors:
10. Click on services tab and open the service which we created:
11. Check for service name. This service name should be given in client policy as hostname.
12. Now check for IntegrationServer’s status. It is ready:
13. Now create TCPIPClient Integration server. No need to create any service for TCPIPClient Integration server. Except step 7, repeat all steps from 1-8 to create tcpipclient Integration Server with bar TCP_Client.bar
Refresh and check the Integration Server status, it should be “Ready”:
Check the tcpipclient pod and logs and confirm server started successfully
Now we can test the message flow:
Send input message using any Rest Client:
We received the response message:
Check for trace output files in server and client pods:
Server pod:
CPIP_TRACE.txt, TCPClientTutorialOutput.txt and TCPClientTutorialOutput.txt will be created under client pod:
Scenario 2: How to create and connect TCP/IP Server running outside CP4I to TCP/IP client running on CP4I and message communication between them.
Here TCPIP Server is on linux machine and Client is on CP4I.
Create TCPIPServer IntegrationServer on linux machine and deploy TCP_Server.bar
Create one Integration Server for Client in CP4I (Please refer screenshots in above scenario for TCPIPClient IntegrationServer creation). Before creating client IntegrationServer, we need to change hostname in policy xml. Here hostname is hostname of linux machine where we created TCPIPServer IntegrationServer.
Now test the flow:
Check for trace output in linux machine (TCPIPServer):
Check for trace outputs in CP4I pod (TCPIP Client):