This appendix provides examples for using the listening and target connectors delivered with PeopleSoft Integration Broker, and discusses how to:
Set up meta data for the examples.
Use the PeopleSoft connectors.
Use the HTTP connectors.
Use the PeopleSoft 8.1 connectors.
Use the JMS connectors.
Use the AS2 connectors.
Use the simple file target connector.
Use the FTP target connector.
Use the SMTP target connector.
This appendix presents examples of how to use the connectors delivered with PeopleSoft Integration Broker.
Note. While still delivered with PeopleSoft Integration Broker, the POP3 target connector is a deprecated technology. Its functionality is now provided with the GetMail target connector. For an example of how to use the GetMail connector, please refer to the PeopleSoft Multichannel Framework PeopleBook.
The intention of the examples provided in this appendix is to provide a starting point for exploring how the connectors work. The examples are designed to be simple and require the minimum set up and configuration necessary to invoke them.
If you try these example and choose to cut the code examples provided in this document and paste them into PeopleSoft Application Designer, the PeopleSoft Pure Internet Architecture, or text or XML editors, verify that single or double quotation marks are pasted into these mediums as straight quotes. Slanted or curly quotes will cause the code examples to fail.
See Also
To use this appendix, you should have basic experience using PeopleSoft Integration Broker. There is little background information presented in this appendix and many of the basic steps involved in creating integrations are presented in general terms (for example, “create a new message.”) Please refer to the appropriate chapters in this PeopleBook for information on how to complete basic tasks.
This section discusses how to set up meta data for the examples presented in this appendix and discusses how to:
Create message channels, request messages, response messages, and pages.
Create nodes and transactions.
Set up integration gateway logging.
Before you use the examples in this appendix, you must set up meta data as described in this section.
Note. The examples presented in this appendix demonstrate using one type of connector at a time. The examples share the same basic definitions for the request message, response message, transactions, and the test page. As a result, you should attempt to run only one example at a time, since the underlying meta data and objects are shared.
The exact requirements for setting up the listening and target connectors do differ somewhat, but since the differences are fairly minor the steps are combined in this section.
Before you begin the set up data for the examples, configure and start the integration gateway.
This section describes creating message channels, request and response messages, and pages for use in the running the connector examples presented in this appendix.
Unless otherwise notes, use PeopleSoft Application Designer to complete these tasks.
To create message channels, messages, and pages:
Create a new message channel.
Name the message channel EXAMPLE_CHANNEL
Verify in the channel properties that the Status is set to Run.
In the PeopleSoft Pure Internet Architecture, configure the security for the Integration Broker Monitor so that the channel can be displayed.
In the PeopleSoft Pure Internet Architecture, use the Integration Broker Monitor to verify that the EXAMPLE_CHANNEL is running.
Create a new request message.
Open the properties and select the Active box for the Status.
Set the message channel to EXAMPLE_CHANNEL.
Save this message as EXAMPLE_REQUEST_MSG.
Create a new response message.
Open the properties and select the Active box for the Status.
Set the message channel to EXAMPLE_CHANNEL.
Save this message as EXAMPLE_RESPONSE_MSG.
Create a new record.
Insert the character field TEST into the record.
Select Derived/Work as the Record Type.
Save the record as EXAMPLE_WORKREC.
Create a new page with a single push button.
Create a new page.
Add a push button with the following properties:
Property |
Value |
Destination |
PeopleCode Command |
RecordName |
EXAMPLE_WORKREC |
Field Name |
TEST |
Resize the button and label it Test target connector.
Save the page as EXAMPLE_PAGE.
Add the page to a component. This may be an existing component or a new one. Ensure that the security settings for the component allow the new page to be accessed.
Use the PeopleSoft Pure Internet Architecture to complete the following tasks.
Creating Source Nodes and Transactions
You must create a node that will be the source of all requests to the listening connectors.
To create a source node and a transaction:
Add a new node called SOURCENODE. Verify that the Active Node check box has been selected. Save this node.
Add a new transaction to the SOURCENODE.
Complete the field definitions as follows:
Field |
Value |
Transaction Type |
Inbound Synchronous |
Request Message |
EXAMPLE_REQUEST_MSG |
Message Version |
VERSION_1 |
On the Transactions tab, verify that the Status is set to Active.
On the Messages tab, verify that Synchronous Logging is set to Header and Detail.
Add the response message details as follows:
Field |
Value |
Message Name |
EXAMPLE_RESPONSE_MSG |
Message Version |
VERSION_1 |
Save the transaction.
Adding Target Nodes and Transactions
You must create a target node and a transaction for all outgoing requests for the target connectors.
To add a target node and a transaction:
Add a new node called TARGETNODE. Verify that the Active Node check box has been selected. Save this node.
Add a new transaction to the TARGETNODE.
Complete the field definitions as follows:
Field |
Value |
Transaction Type |
Outbound Synchronous |
Request Message |
EXAMPLE_REQUEST_MSG |
Message Version |
VERSION_1 |
On the Transactions tab, verify that the Status is set to Active.
On the Messages tab, verify that Synchronous Logging is set to Header and Detail.
Add the response message details as follows:
Field |
Value |
Message Name |
EXAMPLE_RESPONSE_MSG |
Message Version |
VERSION_1 |
Save the transaction.
Add a new transaction to the TARGETNODE.
Complete the field definitions as follows:
Field |
Value |
Transaction Type |
Outbound Asynchronous |
Request Message |
EXAMPLE_REQUEST_MSG |
Message Version |
VERSION_1 |
On the Transactions tab, verify that the Status is set to Active.
Save the transaction.
The integration gateway has message and error logging capabilities. If problems arise while trying the examples, these logs can be invaluable in determining where problems are occurring.
See Managing Integration Gateway Message and Error Logging.
This section discusses using the PeopleSoft listening and PeopleSoft target connectors.
The example provided for using the PeopleSoft target connector demonstrates using the connector to send an asynchronous message between two PeopleSoft nodes.
The example provided for using the PeopleSoft listening connector demonstrates using Send Master to send a message into the local system for processing.
To use the PeopleSoft target connector example you must have a second PeopleSoft 8.4x system. You must have the application server, the PeopleSoft Pure Internet Architecture and the Integration Gateway configured and running.
Note. In this section, the current PeopleSoft system is referred to as the originating system, and the second PeopleSoft system is called the destination system.
This section provides an example of using the PeopleSoft target connector and describes how to:
Set up data on the originating system.
Set up data on the destination system.
Test the PeopleSoft target connector.
Setting Up Data on the Originating System
To set up data on the originating system:
In PeopleSoft Application Designer, create a new request message.
Open the properties and select the Active box for the Status.
Set the message channel to EXAMPLE_CHANNEL.
Save this message as EXAMPLE_PSFT_MSG.
Open the EXAMPLE_WORKREC record.
Add the following PeopleCode to the FieldChange event for the TEST field.
/* create an XML document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); /* and send it out in an async request */ &success = PublishXmlDoc(&xmlDoc, Message.EXAMPLE_PSFT_MSG); MessageBox(0, "", 0, 0, "Message sent.");
Save the changes
In the PeopleSoft Pure Internet Architecture, use the Node Definitions component to add a new node.
Name the node using the name of the destination system.
Verify that the Active Node box is selected.
Save the changes.
Use the Node Definitions — Transaction tab to add an outbound transaction to the new node.
Complete the field definitions as follows:
Field |
Value |
Transaction Type |
Outbound Asynchronous |
Request Message |
EXAMPLE_PSFT_MSG |
Request Message Version |
VERSION_1 |
In the Transactions Detail section, verify that the Status is set to Active.
Save the transaction.
On the Node Definitions-Connectors page, set the Connector ID to PSFTTARGET and save the changes.
Use the Gateways component to set the BEA Jolt connection information for the destination node.
Setting Up Data on the Destination System
To set up data on the destination system:
Create a new message channel called EXAMPLE_CHANNEL.
Verify in the channel properties that the Status is set to Run.
Configure the security for the Integration Broker Monitor so that the channel can be displayed.
In Integration Broker Monitor, verify that the EXAMPLE_CHANNEL is running.
Create a new request message.
Open the properties and select the Active box for the Status.
Set the message channel to EXAMPLE_CHANNEL.
Save this message as EXAMPLE_PSFT_MSG.
Add a subscription to the EXAMPLE_PSFT_MSG message.
Name the subscription ExampleSubscription.
Add the following PeopleCode to the subscription body.
/* get the incoming message */ &msg = GetMessage(); &msgXML = &msg.GenXMLString(); /* and write it to a file */ &file = GetFile("PSFTmsg.txt", "w"); &file.writeString(&msgXML); &file.close();
In the PeopleSoft Pure Internet Architecture, use the Node Definitions component to add a node.
Name the node using the name of the originating system.
Verify that the Active Node box is selected.
Save the changes.
Use the Node Definitions — Transaction tab to add an inbound transaction to the new node.
Complete the field definitions as follows:
Field |
Value |
Transaction Type |
Inbound Asynchronous |
Request Message |
EXAMPLE_PSFT_MSG |
Request Message Version |
VERSION_1 |
In the Transactions Detail section, verify that the Status is set to Active.
Save the transaction.
Testing the PeopleSoft Target Connector
To test the PeopleSoft target connector:
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.
On the originating system, open Integration Broker Monitor to view the details of the message sent to the destination system.
On the destination system, open Integration Broker Monitor to view the details of the received message. Open the PSFTmsg.txt file created by the subscription PeopleCode to view the body of the message.
This section provides an example for testing the PeopleSoft listening connector.
Testing the PeopleSoft Listening Connector
To test the PeopleSoft listening connector:
In PeopleSoft Application Designer, open the EXAMPLE_REQUEST_MSG and add the following PeopleCode to the OnRequest message event.
/* get the body of the incoming message */ &xmlDoc = GetMessageXmlDoc(); /* and write it out to a file */ &theFile = GetFile("PSFTmsg.txt", "W"); &theFile.writestring(&xmlDoc.GenXmlString()); &theFile.Close(); /* create the response message */ &msg = CreateMessage(Message.EXAMPLE_RESPONSE_MSG); /* create the body for the response message */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.AddElement("ResponseMessage"); &descNode.NodeValue = "This was generated in the OnRequest event."; /* add the body to the message */ &msg.SetXmlDoc(&xmlDoc); /* and send the response message */ ReturnToServer(&msg);
Start Send Master and create an 8.4 Integration Broker (MIME) project.
In the URL field enter the address of the PeopleSoft listening connector:
http://your_server_name/PSIGW/PeopleSoftListeningConnector
Replacing <your_server_name> with the details of the server where the gateway is running. For example:
http://machine1234/PSIGW/PeopleSoftListeningConnector
In the Requesting Node field, enter SOURCENODE.
In the Message Name field, enter EXAMPLE_REQUEST_MSG.
From the Message Type list, select Sync.
Click the Input File tab and enter the following XML:
<?xml version="1.0"?><Test>Data</Test>
Click the Post button.
The response from the server displays in the Output Information section. Open the PSFTmsg.txt file created by the subscription PeopleCode to view the body of the message.
This section discusses how to:
Use the HTTP listening connector.
Use the HTTP target connector.
When using the examples for using the HTTP target connector, an HTTP server is needed to receive the HTTP request and to return a response. If using the SOAP example, the HTTP server must be able to process SOAP messages.
This section provides examples of how to set credentials for HTTP requests coming into the integration gateway, and discusses how to:
Set credentials in message bodies.
Set credentials in HTTP headers.
Set credentials in query strings.
Set credentials in SOAP-specific HTTP headers.
Setting Up for Using the HTTP Listening Connector Examples
In PeopleSoft Application Designer, open the message EXAMPLE_REQUEST_MSG and add the following PeopleCode to the OnRequest message event:
/* get the body of the incoming message */ &xmlDoc = GetMessageXmlDoc(); /* and write it out to a file */ &theFile = GetFile("HttpRequest.txt", "W"); &theFile.writestring(&xmlDoc.GenXmlString()); &theFile.Close(); /* create the response message */ &msg = CreateMessage(Message.EXAMPLE_RESPONSE_MSG); /* create the body for the response message */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.AddElement("ResponseMessage"); &descNode.NodeValue = "This was generated in the OnRequest event."; /* add the body to the message */ &msg.SetXmlDoc(&xmlDoc); /* and send the response message */ ReturnToServer(&msg);
Setting Credentials in the Message Body
To set HTTP request credentials in the message body:
Start Send Master, and create a new Input File project.
In the URL field enter:
http://<your_server_name>/PSIGW/HttpListeningConnector
Replace <your_server_name> with the details of the server where the integration gateway is running. For example:
http://machine1234/PSIGW/HttpListeningConnector
In the Input section, paste the following XML. Notice that the message name and requesting node are present in the XML
<?xml version="1.0"?> <IBRequest> <MessageName>EXAMPLE_REQUEST_MSG</MessageName> <From> <RequestingNode>SOURCENODE</RequestingNode> </From> <ContentSections> <ContentSection> <Data> <![CDATA[<?xml version="1.0"?><ConnectorTest> Testing the HTTPListeningConnector. Message body. </ConnectorTest>]]> </Data> </ContentSection> </ContentSections> </IBRequest>
Click the Post button to sent the message to the integration gateway.
Check the Output section for the response. Compare the response with the PeopleCode used in the OnRequest event for the message. Also check the HttpRequest.txt file created by the OnRequest PeopleCode to see the body of the request message received by the application server.
Setting Credentials in HTTP Headers
To set HTTP request credentials in the HTTP header:
Start Send Master, and create a new Input File project.
In the URL field enter:
http://<your_server_name>/PSIGW/HttpListeningConnector
Replace <your_server_name> with the details of the server where the integration gateway is running. For example:
http://machine1234/PSIGW/HttpListeningConnector
In the Headers field enter the following:
MessageName:EXAMPLE_REQUEST_MSG From:SOURCENODE
In the Input section, paste the following:
<?xml version="1.0"?> <ConnectorTest> Testing the HTTPListeningConnector. HTTP Header. </ConnectorTest>
Click the Post button to sent the message to the integration gateway.
Check the Output section for the response. Compare the response with the PeopleCode used in the OnRequest event for the message. Also check the HttpRequest.txt file created by the OnRequest PeopleCode to see the body of the request message received by the application server.
Setting Credentials in Query Strings
To set HTTP request credentials in a query string:
Start Send Master, and create a new Input File project.
In the URL field enter:
http://your_server_name/PSIGW/HttpListeningConnector?&MessageName=
EXAMPLE_REQUEST_MSG&From=SOURCENODE
Replace <your_server_name> with the details of the server where the integration gateway is running. For example:
http://machine1234/PSIGW/HttpListeningConnector?&MessageName=
EXAMPLE_REQUEST_MSG&From=SOURCENODE
In the Input section, paste the following:
<?xml version="1.0"?> <ConnectorTest> Testing the HTTPListeningConnector. Query String. </ConnectorTest>
Click the Post button to sent the message to the integration gateway.
Check the Output section for the response. Compare the response with the PeopleCode used in the OnRequest event for the message. Also check the HttpRequest.txt file created by the OnRequest PeopleCode to see the body of the request message received by the application server.
Setting Credentials in SOAP-Specific HTTP Headers
To set HTTP request credentials in a SOAP-specific HTTP header:
Start Send Master, and create a new Input File project.
In the URL field enter:
http://your_server_name/PSIGW/HttpListeningConnector
Replacing <your_server_name> with the details of the server where the gateway is running. For example:
http://machine1234/PSIGW/HttpListeningConnector
In the Header field, add the following:
SOAPAction: http://peoplesoft.com/EXAMPLE_REQUEST_MSG/SOURCENODE//
In the Input section, paste the following:
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.encoding/"
xmlns:SOAP-ENV="http://schema.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <ConnectorTest> <Text> Testing the HTTPListeningConnector. SOAP Message. </Text> </ConnectorTest> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Click the Post button to sent the message to the integration gateway.
Check the Output section for the response. Compare the response with the PeopleCode used in the OnRequest event for the message. Also check the HttpRequest.txt file created by the OnRequest PeopleCode to see the body of the request message received by the application server.
This section provides examples of using the HTTP target connector and discusses how use the connector to:
Send standard HTTP requests.
Send SOAP messages in HTTP requests.
Sending Standard HTTP Requests
To send a standard HTTP request:
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field.
/* create an XML document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); /* add text to it */ &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.AddElement("TestNode"); &descNode.NodeValue = "This message will be sent to an HTTP server."; /* send the document out as a sync message */ &xmlResponseDoc = SyncRequestXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG); /* convert the response to an XML string */ &textString = &xmlResponseDoc.GenXmlString(); /* and echo it back to the user */ MessageBox(0, "", 0, 0, &textString);
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE. Set the Connector ID to HTTPTARGET. Set the URL property value to the address of the HTTP server that will process the request.
Open the EXAMPLE_PAGE page, and click on the Test button. The HTTP response will be displayed in the resulting message box.
Sending SOAP Messages in HTTP Requests
To send a SOAP message in an HTTP request:
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field.
/* create a SOAP document */ &soapReq = CreateSOAPDoc(); &soapReq.AddMethod("TestNode", 1); &soapReq.AddParm("Text", "This is a SOAP request."); /* and send the document out in a sync message */ &request = &soapReq.XmlDoc; &response = SyncRequestXmlDoc(&request, Message.EXAMPLE_REQUEST_MSG); /* convert the response to a SOAP document */ &soapRes = CreateSOAPDoc(); &soapRes.XmlDoc = &response; /* and echo the SOAP XML back to the user */ &strXml = &soapRes.GenXmlString(); MessageBox(0, "", 0, 0, &strXml);
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE.
On the Node Definitions-Connectors tab, set the Connector ID to HTTPTARGET.
Set the URL property value to the address of the HTTP server that will process the request.
Open the EXAMPLE_PAGE page, and click on the Test button. The HTTP response will be displayed in the resulting message box.
The examples provided in this section demonstrate sending a rowset-based asynchronous message between a PeopleSoft 8.4 node and a PeopleSoft 8.1 node.
When sending a message from a PeopleSoft 8.4 system to a PeopleSoft 8.1 system, you will use the PeopleSoft 8.1 target connector. You will also use PeopleCode, as well as the example page and work record that you created using the information in the setup section at the beginning of this appendix.
When sending a message from a PeopleSoft 8.1 system to a PeopleSoft 8.4 system, you will use the PeopleSoft 8.1 listening connector. You will also use the test message functionality in PeopleSoft Application Designer.
This section describes setting up data for using the PeopleSoft 8.1 connector examples.
Setting Up Data on the PeopleSoft 8.4 System
To set up data on the PeopleSoft 8.4 system:
In PeopleSoft Application Designer, create a new field called EXAMPLE_CHAR. This should be a mixed-case character field of size 20.
Create a new record.
Name the record EXAMPLE_REC.
Add the EXAMPLE_CHAR field to this record, set it as the key, and save the definition.
Build the physical table for this record.
Create a new message.
Open the properties and click the Active box for the Status.
Set the Message Channel to EXAMPLE_CHANNEL.
Add the EXAMPLE_REC record to VERSION_1 of this message.
Save the message as EXAMPLE_PSFT_MSG.
Create a subscription on the EXAMPLE_PSFT_MSG message called ExampleSubscription, with the following PeopleCode:
/* get the body of the incoming message */ &xmlDoc = GetMessageXmlDoc(); /* and write it out to a file */ &theFile = GetFile("PSFT81Message.txt", "W"); &theFile.writestring(&xmlDoc.GenXmlString()); &theFile.Close();
Open the EXAMPLE_PAGE page and add an EditBox to the page, setting the following properties:
Property |
Value |
Record name |
EXAMPLE_REC |
Field name |
EXAMPLE_CHAR |
Open the EXAMPLE_WORKREC record. Add the following PeopleCode to the FieldChange event for the TEST field:
/* get the buffer data */ &rowset = GetLevel0(); /* build a message */ &message = CreateMessage(Message.EXAMPLE_PSFT_MSG); /* copy buffer data to the message */ &message.CopyRowset(&rowset); /* send the message */ &message.Publish(); MessageBox(0, "", 0, 0, "Message sent".);
In the PeopleSoft Pure Internet Architecture, add a new node, using the node name of the PeopleSoft 8.1 system. Verify that the Active Node box is checked, and save the record.
Add an inbound transaction to the new node with the following properties. After doing so, verify that the transaction is active and save it.
Field |
Value |
Transaction Type |
Inbound Asynchronous |
Request Message |
EXAMPLE_PSFT_MSG |
Request Message Version |
VERSION_1 |
Add an outbound transaction to the new node with the following properties. After doing so, verify that the transaction is active and save it.
Field |
Value |
Transaction Type |
Outbound Asynchronous |
Request Message |
EXAMPLE_PSFT_MSG |
Request Message Version |
VERSION_1 |
Go to the connector information for the new node. Set the Connector ID to PSFT81TARGET. Set the URL property to the address of the gateway servlet on the PeopleSoft 8.1 system. For example:
http://<theServerNameAndPort>/servlets/gateway
Setting Up Data on the PeopleSoft 8.1 System
To set up data on the PeopleSoft 8.1 system:
In PeopleSoft Application Designer, create a new field called EXAMPLE_CHAR. This should be a mixed-case character field of size 20.
Create a new record.
Name the record EXAMPLE_REC.
Add the EXAMPLE_CHAR field to this record, set it as the key, and save the definition.
Build the physical table for this record.
Create a new message channel called EXAMPLE_CHANNEL. On the properties dialog box, set the Status to Run. Configure the security for the message monitor so that the channel can be displayed.
Create a new message.
Open the properties and select the Active box for the Status.
Set the Message Channel to EXAMPLE_CHANNEL.
Add the EXAMPLE_REC record to VERSION_1 of this message.
Save the message as EXAMPLE_PSFT_MSG.
Add the subscription ExampleSubscription to the EXAMPLE_PSFT_MSG. Use the following PeopleCode in the subscription body:
/* get the incoming message */ &msg = GetMessage(); &msgXML = &msg.GenXMLString(); /* and write it to a file */ &file = GetFile("PSFT81msg.txt", "w"); &file.writeString(&msgXML); &file.close();
Create a new message node, using the name of the PeopleSoft 8.4 node. Add a Location to this node with the following format:
http://<serverName:port>/PSIGW/PS81ListeningConnector
The serverName and port you specify must correspond to the integration gateway address of the PeopleSoft 8.4 system.
Open the EXAMPLE_CHANNEL. Add a new routing rule to the channel, where the direction is Both and the message node name is that of the PeopleSoft 8.4 node.
In the PeopleSoft Pure Internet Architecture, invoke the Gateway Administration servlet and add the PeopleSoft 8.1 node to the PeopleSoft handler.
Open the Message Monitor and verify that the EXAMPLE_CHANNEL is running.
In the example presented in this section, you will use the PeopleSoft 8.1 target connector to send a message from a PeopleSoft 8.4 system to a PeopleSoft 8.1 system.
To send a message from a PeopleSoft 8.4 system to a PeopleSoft 8.1 system:
In the PeopleSoft Pure Internet Architecture on the PeopleSoft 8.4 system, open the EXAMPLE_PAGE. Enter text into the edit box, and press the Test button. Wait for a minute or two to allow the systems to process the message.
On the PeopleSoft 8.4 system, open Integration Broker Monitor to view the details of the outbound message.
On the PeopleSoft 8.1 system, open up the Message Monitor to view the details of the received message. Open the PSFT81msg.txt file created by the subscription PeopleCode to see the body of the message.
In the example presented in this section, you will use the PeopleSoft 8.1 listening connector to send a message from a PeopleSoft 8.1 system to a PeopleSoft 8.4 system.
To send a message from a PeopleSoft 8.1 system to a PeopleSoft 8.4 system:
On the PeopleSoft 8.1 system, open PeopleSoft Application Designer and open the EXAMPLE_PSFT_MSG message. Right-click VERSION_1 and select Create test message. The Create Test Message window appears.
Expand Transaction in the tester window. Set the value for EXAMPLE_CHAR. Open the PSCAMA section and set the AUDIT_ACTN to A and click OK. A message is published. Wait a minute or two before proceeding to allow the message to be processed by both nodes.
On the PeopleSoft 8.1 system, open the Message Monitor to view the details of the outbound message.
On the PeopleSoft 8.4 system, open Integration Broker Monitor to view the details of the received message. Open the PSFT81msg.txt file created by the subscription PeopleCode to see the body of the message.
This section discusses using the JMS listening and JMS target connectors.
The examples in this section are intended to be generic and independent of the JMS provider being used. Because of this, in certain steps general instructions are provided. The actual details of the task will depend on the provider being used – and may be rather involved. Please refer to the appropriate documentation.
The error queue is not configured in the examples. However, configuring the error queue may be desirable should issues arise while trying the examples.
The examples in this section focus on queues, but the process for using the JMS connectors when working with topics is essentially the same.
See Also
Working With the JMS Connectors
To use the examples in this section, a JMS provider must be configured and running. Please refer to the provider’s documentation for instructions on how to accomplish these tasks. Ensure that messages can be sent to topics and queues before proceeding with the examples.
For the JMS target connector example, you will need a utility to consume and view the messages created. For the JMS listening connector example, you will need a utility to create the messages. The exact details of these utilities depend on the provider. Some may provide an administrative console that you can use to view the contents of topics and queues, and possibly send new messages to them. Other providers may include sample Java programs that you can use to interact with the provider. Refer to the provider’s documentation for further details.
A special case exists for testing the JMS listening connector and queues when the provider is IBM MQSeries. In this instance, use Send Master to test the JMS listening connector.
See Also
In this example, PeopleSoft Integration Broker will generate a JMS message, which will be consumed outside of the PeopleSoft system.
To use the JMS target connector:
On the JMS provider, create a JMS Connection Factory with the JNDI name ExampleConnectionFactory.
On the JMS provider, create a JMS Queue with the JNDI name ExampleQueue.
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:
/* create an XML document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; /* add text to the document */ &descNode = &rootNode.AddElement("TestNode"); &descNode.NodeValue = "Sending a message to a JMS queue."; /* and send it out in an async request */ &result = PublishXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG); MessageBox(0, "", 0, 0, "Message sent.");
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE. Set the Connector ID to JMSTARGET. Set the values for the following properties:
Property |
Value |
JMSFactory |
ExampleConnectionFactory. |
JMSProvider |
Name of the provider being used. |
JMSUrl |
Connection URL for the provider. |
JMSQueue |
ExampleQueue. |
JMSUserName |
The username on the JMS provider. |
JMSPassword |
The encrypted password for the user ID. |
In the integrationGateway.properties file, set the ig.jms.JMSTargetConnector.JMSProvider.Password property to the same value as was used for the JMSPassword field in the previous step.
Test the connector:
Open the test page, and click on the Test button.
Verify that the message was sent to the queue. The exact mechanism for doing depends on the provider or utility that you are using.
In this example, you will use the JMS listening connector to send a message to the JMS provider. PeopleSoft Integration Broker will consume the message.
To use the JMS listening connector:
On the JMS provider, create a JMS Connection Factory with the JNDI name ExampleConnectionFactory.
On the JMS provider, create a JMS Queue with the JNDI name ExampleQueue.
In PeopleSoft Application Designer, open the message EXAMPLE_REQUEST_MSG and add the following PeopleCode to the OnRequest message event:
/* get the body of the incoming message */ &xmlDoc = GetMessageXmlDoc(); /* and write it to a file */ &theFile = GetFile("JMSRequest.txt", "W"); &theFile.writestring(&xmlDoc.GenXmlString()); &theFile.Close(); /* create the reponse message */ &msg = CreateMessage(Message.EXAMPLE_RESPONSE_MSG); /* build the body of the response */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.AddElement("ResponseMessage"); &descNode.NodeValue = "This was generated in the OnRequest event."; /* add the body to the message */ &msg.SetXmlDoc(&xmlDoc); /* send the response message */ ReturnToServer(&msg);
In the integrationGateway.properties file, uncomment the following line:
ig.jms.Queues=1
Set the following properties to the values indicated:
Property |
Value |
ig.jms.Queue1 |
ExampleQueue |
ig.jms.Queue1.Provider |
<the name of the provider> |
ig.jms.Queue1.JMSFactory |
ExampleConnectionFactory |
ig.jms.Queue1.Url |
<connection URL for the provider> |
ig.jms.Queue1.Use |
< the userid > |
ig.jms.Queue1.Password |
<the encrypted password for the userid. > |
ig.jms.Queue1.MessageName |
EXAMPLE_REQUEST_MSG |
ig.jms.Queue1.MessageVersion |
VERSION_1 |
ig.jms.Queue1.RequestingNode |
SOURCENODE |
ig.jms.Queue1.DestinationNode |
<the name of the local node > |
Deploy and start the JMSListeningConnectorAdministrator servlet.
Test the connector:
Send a text message to the example JMS queue. Set the text of the message to:
<?xml version="1.0"?> <ConnectorTest> <TestNode>Sending a message to the JMS Listening Connector.</TestNode> </ConnectorTest>
Check the message logs and the file named in the OnRequest PeopleCode. The message should be present in both.
This section discusses using the AS2 listening and AS2 target connectors.
The purpose of the AS2 protocol is to allow the secure exchange of EDI data over the internet with trading partners. In the simplest case of an AS2 Message exchange, a sender packages data into an AS2 message structure and sends the message to trading partner over HTTP. Any kind of data can be transferred using AS2, including XML, EDI, text and binary.
This examples in this section demonstrate using the AS2 target connector to send an XML message to an external trading partner and using the AS2 listening connector to receive an XML message from a trading partner.
See Also
Working With the AS2 Connectors
To use the examples in this section, security certificates must be setup and registered in the keystore on the source and target machines. Take note of the certificate alias name for both the source or signer and the target or receipient servers, as you will need this information to set connector properties..
Verify that messages can be sent to and received from the AS2 external trading partner over HTTP before proceeding with the examples.
For the AS2 target connector example, you will need a third-party application to consume and view the messages created. For the AS2 listening connector example, you will need a third-party application to create and deliver the messages.
See Also
Setting Up Secure Messaging Environments
In this example PeopleSoft Integration Broker will generate an AS2 message and send it to a trading partner using HTTP. The external trading partner consumes the message. This example shows the tasks to perform to receive an MDN response message back synchronously or asynchronous.
To use the AS2 target connector:
In PeopleSoft Application Designer open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:
/*create an XML document */ Local string &xmldata; Local XmlDoc &xmlDoc; Local XmlNode &rootNode, &descNode; Local boolean &result; &xmldata = "<AS2ConnectorTest/>"; rem <AS2ConnectorTest/>"; &xmlDoc = CreateXmlDoc(""); &rootNode = &xmlDoc.CreateDocumentElement("AS2ConnectorTest"); &rootNode = &xmlDoc.DocumentElement; /* add text to the document */ &descNode = &rootNode.AddElement("TestNode"); &descNode.NodeValue = "Sending a AS2 message."; /* and send it out in an async request */ &result = PublishXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG); MessageBox(0, "", 0, 0, "AS2 Message sent.");
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE. Set the Connector ID to AS2TARGET. Set the values for the following required properties:
Property Name |
Value |
URL |
Specify the URL to which messages are sent using thisconnector. |
AS2To |
Specify the name of the sending node. |
AS2From |
Specify the name of the receiving node. |
RecipientCertAlias |
Specify the alias of the receiving certificate. |
SignersCertificateAlias |
Specify the alias of the signing certificate. |
Add an outbound asynhcronous transaction on the AS2TARGETNODE, to identify that the message EXAMPLE_MESSAGE, VERSION_1 will be sent to the URL location.
Set the following properties in the integrationGateway.properties file. Use PSCipher.bat utility located at <PS_HOME>\webserv\peoplesoft to encrypt the keystore password.
#AS2 Log Directory, logs all incoming and outgoing AS2 request and responses. #Uncomment and specify the correct directory name to enable logging. ig.AS2.LogDirectory = c://temp//as2 #AS2 Properties #Uncomment the following two lines to specify your keystore and AS2 properties ig.AS2.KeyStorePath=KeyStore Location (use // for windows path) ig.AS2.KeyStorePassword=EncryptedKeyStorePassword ig.AS2.AS2Directory=Location of AS2 Certificates (required for Async MDN Type) ig.AS2.LogDirectory=Path to store AS2 Log Files (optional) Examples ig.AS2.KeyStorePath=C://pt846-112-R2//webserv//peoplesoft//keystore//pskey ig.AS2.KeyStorePassword=GD9klUFw8760HVaqeT4pkg== ig.AS2.AS2Directory=c://temp//as2 ig.AS2.LogDirectory = c://temp//as2//logs
If the MDN response is synchronous, go to step 8.
If the MDN response is asynchronous, verify the delivered node named ASYNC_MDN exists.
Verify that the node ASYNC_MDN has an active incoming asynchronous transaction for the message ASYNC_MDN_RESPONSE, VERSION_1.
Verify that the delivered channel AS2_CHANNEL is not in Pause mode.
Test the connector.
Open the test page, and click on the Test button.
Verify that the message was sent to the recipient. The exact mechanism for doing so depends on the AS2 trading partner you are using.
Verify that the MDN response was sent back to the source. The exact mechanism for doing so depends on the AS2 trading partner you are using.
If the MDN type is set to Async, verify that the ASYNC_MDN_RESPONSE was received.
In this example, you will use the AS2 listening connector to receive a message sent by the AS2 trading partner, and return an MDN synchronous or asynchronous response. Perform all tasks on the target machine. PeopleSoft Integration Broker will consume the message.
To use the AS2 listening connector:
In the PeopleSoft Pure Internet Architecture, choose the node that corresponds to the AS2 trading partner sending the message.
Insert an inbound asynchronous transaction corresponding to the EXAMPLE_REQUEST_MSG, VERSION_1 expected.
Insert an outbound asynchronous transaction corresponding to the EXAMPLE_RESPONSE_MSG, VERSION_1 as a reply.
In PeopleSoft Application Designer, open the message EXAMPLE_REQUEST_MSG, VERSION_1 that you created in the Using the AS2 Target Connector section..
Right-click the message object name and choose Insert Message Subscription.
Name the subscription event EXAMPLE_SUBSCRIPTION and verify that it is active.
Add the following PeopleCode to the Subscription message event:
Note. Subscription PeopleCode that consumes the EXAMPLE_REQUEST_MSG is required to retrieve the AS2 message and send an MDN back to the source.
Local XmlDoc &xmlDoc; Local File &theFile; Local Message &msg; Local XmlNode &rootNode, &descNode; /* get the body of the incoming message */ &xmlDoc = GetMessageXmlDoc(); /* and write it to a file */ &theFile = GetFile("AS2Request.txt", "W"); &theFile.WriteString(&xmlDoc.GenXmlString()); &theFile.Close(); /* OPTIONAL RESPONSE MESSAGE CODE */ /* create the reponse message */ /* build the body of the response */ &xmlDoc = CreateXmlDoc(""); &rootNode = &xmlDoc.CreateDocumentElement("ConnectorTest"); &rootNode = &xmlDoc.DocumentElement; /* add text to the document */ &descNode = &rootNode.AddElement("ResponseMessage"); &descNode.NodeValue = "This was generated in the OnRequest event."; /* send the response message */ &result = PublishXmlDoc(&xmlDoc, Message.EXAMPLE_RESPONSE_MSG);
In the integrationGateway.properties file, set the following properties to the values indicated:
#AS2 Properties #Uncomment the following two lines to specify your keystore and AS2 properties ig.AS2.KeyStorePath=KeyStore Location (use // for windows path) ig.AS2.KeyStorePassword=EncryptedKeyStorePassword ig.AS2.LogDirectory=Path to store AS2 Log Files (optional) #example: ig.AS2.KeyStorePath=C://pt846-112-R2//webserv//peoplesoft//keystore//pskey ig.AS2.KeyStorePassword=GD9klUFw8760HVaqeT4pkg== ig.AS2.LogDirectory = c://temp//as2//logs
In the following required properties, replace the <SOURCENODE> with the name of the AS2 trading partner source node, and <TARGETNODE> with the name of the local target node. Continue to set the value of the property.
# CertificateAlias is the certificate of AS2 Listening Node. # SignerCertificateAlias is the certificate of AS2 trading partner of Listening Node. ig.AS2.QE_<SOURCE>.<TARGET>.CertificateAlias= Target Machine Alias ig.AS2. <SOURCE>.<TARGET>.SignerCertificateAlias=Source Machine Alias #example: ig.AS2.PT_LOCAL.AS2TARGETNODE.CertificateAlias=JFRANCO030204 ig.AS2.PT_LOCAL.AS2TARGETNODE.SignerCertificateAlias=JRICHAR2030104
The following values only need to be set if the incoming data does not contain the appropriate AS2To and AS2From values in the header of the message. It is best to leave these values in the request message header and leave these properties commented out.
#This map translate AS2From and AS2To to a different node name. #This property is not required if you would use AS2FROM and AS2TO http header. ig.AS2.AS2ListenerMap.From.<SOURCEALIAS> = Specify the Source Node Name ig.AS2.AS2ListenerMap.To.<TARGETALIAS> = Specify the Target Node Name #example: ig.AS2.AS2ListenerMap.From.QE_SOURCE= PT_LOCAL ig.AS2.AS2ListenerMap.To. QE_IBTGT= AS2TARGETNODE
Test the connector:
Send a text message to the example AS2 queue. Name the message EXAMPLE_REQUEST_MSG.
Set the text of the message to:
<?xml version="1.0"?> <ConnectorTest> <TestNode>Sending a message to the AS2 Listening Connector.</TestNode> </ConnectorTest>
Check the file named in the subscription PeopleCode. The default location for this file is <PS_HOME>\appserv\<APPSERVER_NAME>\Files. The message contents should be present.
If the MDN type is asynchronous, verify that the AS2 trading partner received the ASYNC_MDN_RESPONSE.
This section describes how to use the simple file target connect to:
Write PeopleSoft data to a file.
Read data into PeopleSoft from a file.
This section describes how to use the simple file target connector to write PeopleSoft data to a file.
To write data to a file:
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record. Add the following PeopleCode to the FieldChange event for the TEST field:
&xmldata = "<?xml version='1.0'?><ConnectorTest/>"; /* create an XmlDoc */ &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; /* add text to the document */ &descNode = &rootNode.AddElement("TestNode"); &descNode.NodeValue = "This message was written to a file."; /* send the Xml in a sync message */ &xmlResponseDoc = SyncRequestXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG);
In the PeopleSoft Pure Internet Architecture, open the node definition TARGETNODE.
On the Node Definitions-Connectors tab, set the Connector ID to FILEOUTPUT.
Add the following connector properties and values:
Property |
Value |
Method |
PUT |
FilePath |
Enter the location where you want the connector to write the file. For example, c:\temp. |
Access the integrationGateway.properties file and comment out the following line.
ig.fileconnector.password=EncryptedPassword
The password option is not used in this example.
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click Test.
Go to the directory specified in the connector properties, and open the new file. The contents should reflect what was created in the PeopleCode.
This section describes how to use the simple file target connector to read data into PeopleSoft from files.
To read data from files into PeopleSoft:
Create an XML file and include the following text:
<?xml version='1.0'?> <ConnectorTest> <TestNode> The file has been read from the file system. </TestNode> </ConnectorTest>
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record. Add the following PeopleCode to the FieldChange event for the TEST field:
/* create an Xml document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); /* make a sync request using the document */ &xmlResponseDoc = SyncRequestXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG); /* get the response, and put it in a message box to be displayed to the user */ &textString = &xmlResponseDoc.GenXmlString(); MessageBox(0, "", 0, 0, &textString);
In the PeopleSoft Pure Internet Architecture, open the TARGETNODE node definition.
Set the Connector ID to FILEOUTPUT.
Set the FilePath property to the location from where the connector read the output file.
Add the following connector properties and values:
Property |
Value |
FileName |
Specify the name of the output file. The file's default name has the following format: sourcenodename.msgname.publication_id.xml |
METHOD |
GET |
Access the integrationGateway.properties file and comment out the following line.
ig.fileconnector.password=EncryptedPassword
The password option is not used in this example.
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.
A message box appears that displays the data from the file read.
This sections discusses how to use the FTP target connector to:
Upload files to an FTP server.
Download files from an FTP server.
For the examples presented in this section, you must have an active FTP server, as well as an account on that server.
To upload a file to an FTP server:
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:
/* create an XML document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); /* add text to it */ &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.AddElement("TestNode"); &descNode.NodeValue = "This message will be uploaded to an FTP server."; /* and send the document out as an async message */ &success = PublishXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG); MessageBox(0, "", 0, 0, "Message sent.");
In the PeopleSoft Pure Internet Architecture, open the TARGETNODE node definition.
On the Node Definitions-Connectors tab, set the Connector ID to FTPTARGET.
Set the following properties to the values indicated:
Property |
Value |
HOSTNAME |
Specify the IP address or name of the FTP server for the connection. |
METHOD |
PUT |
USERNAME |
Enter the FTP server login ID. |
PASSWORD |
Enter the password for the login to the FTP server. This password must be encrypted. Use the Password Encryption Utility at the bottom of the page to encrypt the password, if necessary |
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.
Login to the FTP server and check for the file. Open the file and verify the contents.
To download a file from an FTP server:
Create an XML file with the following contents and place the file on an FTP server.
<?xml version="1.0"?> <ConnectorTest> <TestNode>This message will be downloaded from an FTP server.</TestNode> </ConnectorTest>
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:
/* create an XML document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); /* send the document out in a sync message */ &xmlResponseDoc = SyncRequestXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG); /* convert the response message to an XML string */ &textString = &xmlResponseDoc.GenXmlString(); /* and echo it out to the user */ MessageBox(0, "", 0, 0, &textString);
In the PeopleSoft Pure Internet Architecture, open the TARGETNODE node definition.
On the Node Definitions-Connectors tab, set the Connector ID to FTPTARGET.
Set the following properties to the values indicated:
Property |
Value |
HOSTNAME |
Specify the IP address or name of the FTP server for the connection. |
METHOD |
GET |
FILENAME |
Specify the name of the file. |
USERNAME |
Enter the FTP server login ID. |
PASSWORD |
Enter the password for the login to the FTP server. This password must be encrypted. Use the Password Encryption Utility at the bottom of the page to encrypt the password, if necessary |
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.
The contents of the XML file display in the message box.
This section provides an example of how to use the Simple Mail Transfer Protocol (SMTP) target connector to send an email message using an SMTP server.
For this example, you must have an active SMTP server as well as an active email account to receive the message.
To send an email message to an SMTP server using the SMTP target connector:
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:
/* create an Xml document */ &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; &xmlDoc = CreateXmlDoc(&xmldata); /* add text to the Xml */ &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.AddElement("TestNode"); &descNode.NodeValue = "This message was sent via SMTP to an email account."; /* send an async message containing the Xml */ &success = PublishXmlDoc(&xmlDoc, Message.EXAMPLE_REQUEST_MSG);
In the PeopleSoft Pure Internet Architecture, open the TARGETNODE node definition.
On the Node Definitions-Connectors tab, set the Connector ID to SMTPTARGET.
Set the following properties to the values indicated:
Property |
Value |
DestEmailAddress |
Set this property to the email address to which the email will be sent. |
SourceEmailAddress |
Set this property to the email address from which you are sending the message. |
Access the integrationGateway.properties file. Locate the following line and replace <mailServerName> with the name of the SMTP server.
ig.connector.smtptargetconnector.host=<mailServerName>
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button to send the message.
Check the destination email account for the message. Since the message is being passed through one or more SMTP servers, there may be some propagation delay and the message might not be received immediately.