Example 1: Using the PeopleSoft Connectors
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 invoke a synchronous service operation between two PeopleSoft nodes.
The example provided for using the PeopleSoft listening connector demonstrates using Send Master to invoke a service operation into the local system for processing.
To use the PeopleSoft target connector example you must have a second PeopleSoft 8.55 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, open the EXAMPLE_WORKREC record. Add the following PeopleCode to the FieldChange event for the TEST field:
&msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR); &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; /* create an XmlDoc */ &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.addelement("PSFTtest"); &descNode.nodevalue = "This is a test message."; /* put the XML in the message */ &msg.setxmldoc(&xmlDoc); /* send the request */ &response = %IntBroker.SyncRequest(&msg); /* and echo it back to the user */ &xmlDoc = &response.getxmldoc(); MessageBox(0, "", 0, 0, &xmlDoc.genxmlstring());
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE. Set the ConnectorID to PSFTTARGET.
In the Integration Properties for the gateway, add a new entry for TARGETNODE along with the appropriate values.
ig.isc.TARGETNODE.serverURL=//<machinename>:<port> ig.isc.TARGETNODE.userid=<userid> ig.isc.TARGETNODE.password=<password> ig.isc.TARGETNODE.toolsRel=<toolsRelease>
Setting Up Data on the Destination System
To set up data on the destination system:
Follow the steps outlined in the section Setting Up Metadata to add the following to the destination system:
The EXAMPLE_QUEUE queue.
The EXAMPLE_REQUEST_MSG message.
The EXAMPLE_RESPONSE_MSG message.
The EXAMPLE_SERVICE service.
The EXAMPLE_SERVICE_OPR synchronous service operation.
Add a node entry for the originating system. Ensure that the Single Signon security is configured so that the destination system accepts authentication tokens from the originating system.
Add a new inbound synchronous routing between the originating system and the destination for the EXAMPLE_SERVICE_OPR service operation.
In the PeopleSoft Pure Internet Architecture, for service operation EXAMPLE_SERVICE_OPR add a handler of type OnRequest with implementation type App Class. Create a handler application class based on the IRequestHandler interface, and for the method OnRequest add the following PeopleCode:
Local XmlDoc &xmldoc; Local File &theFile; Local XmlNode &rootNode, &descNode; Local Message &response; Local string &xmldata; /* get the body of the incoming message */ &xmldoc = &_MSG.GetXmlDoc(); /* and write it out to a file */ &theFile = GetFile("ARequest.txt", "W"); &theFile.WriteString(&xmldoc.GenXmlString()); &theFile.Close(); /* create the response message */ &response = CreateMessage(Operation.EXAMPLE_SERVICE_OPR, %IntBroker_Response); /* 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 */ &response.SetXmlDoc(&xmldoc); /* and return the response message */ Return &response;
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. The response message will be displayed in a message box.
On the destination system, open Service Operations Monitor to view the details of the received message. Open the text file created by the OnRequest PeopleCode to view the details of service operation request received.
This section provides an example for testing the PeopleSoft listening connector.
Testing the PeopleSoft Listening Connector
To test the PeopleSoft listening connector:
In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_SERVICE_OPR service operation and add a handler of type OnRequest with implementation type App class. The OnRequest method of App class should have following PeopleCode:
Local XmlDoc &xmldoc; Local File &theFile; Local XmlNode &rootNode, &descNode; Local Message &response; Local string &xmldata; /* get the body of the incoming message */ &xmldoc = &_MSG.GetXmlDoc(); /* and write it out to a file */ &theFile = GetFile("HttpRequest.txt", "W"); &theFile.WriteString(&xmldoc.GenXmlString()); &theFile.Close(); /* create the response message */ &response = CreateMessage(Operation.EXAMPLE_SERVICE_OPR, %IntBroker_Response); /* 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 */ &response.SetXmlDoc(&xmldoc); /* and return the response message */ Return &response;
Start Send Master and create an 8.48 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 Ext. Operation name field, enter EXAMPLE_SERVICE_OPR.v1.
From the Operation 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. Note that this is a MIME response; look near the end to find the response XML generated by the OnRequest PeopleCode. Open the text file created by the OnRequest method of application class to view the body of the request message.