Professional Documents
Culture Documents
51
1.
OVERVIEW ........................................................................................................................... 4 1.1. 1.2. 1.3. 1.4. Environment ................................................................................................................ 4 Aim ............................................................................................................................... 4 Prerequisite Knowledge............................................................................................... 4 Project .......................................................................................................................... 4 Activate application server pub/sub processes........................................................... 5 Enable communication between application server and web server ......................... 9 Enable communication between web server and application server ......................... 9 Setup web service configuration ............................................................................... 14 Activate Integration Broker Domains ........................................................................ 15 Modify Internal Nodes ............................................................................................... 16 Component navigation .............................................................................................. 17 Generate Component Interface ................................................................................ 18 Component Interface Security................................................................................... 20 Generate CI Based Service ......................................................................................... 21 Provide CI Based Service............................................................................................ 26 Call CI Based Service via SoapUI ................................................................................ 28 Call PeopleSoft Service PeopleCode .......................................................................... 32 Mock Service.............................................................................................................. 38 Create Node ............................................................................................................... 41 Import WSDL.............................................................................................................. 43 PeopleCode ................................................................................................................ 49 Messages ................................................................................................................... 52 Service........................................................................................................................ 54 PeopleCode ................................................................................................................ 56 Routing and Handler .................................................................................................. 58 Deploy Service ........................................................................................................... 59 Service Operation Tester ........................................................................................... 61 Call from SoapUI ........................................................................................................ 63 PeopleCode call ......................................................................................................... 65
Page 2 of 84
2.
3.
PROVIDE COMPONENT INTERFACE SERVICE .................................................................... 17 3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7.
4.
5.
CUSTOM PEOPLESOFT APPLICATION CLASS SERVICE ....................................................... 52 5.1. 5.2. 5.3. 5.4. 5.5. 5.6. 5.7. 5.8.
6.
TRANSLATIONS .................................................................................................................. 67 6.1. 6.2. 6.3. 6.4. 6.5. 6.6. Setup Transform Message ......................................................................................... 67 Setup XSLT Application Engine .................................................................................. 68 Delete WSDL .............................................................................................................. 71 Add Transformation to Service .................................................................................. 72 Provide Service .......................................................................................................... 73 Call service using SoapUI ........................................................................................... 73 Activate Pub/Sub Servers .......................................................................................... 74 Activate Process Scheduler........................................................................................ 74 Create Application Engine ......................................................................................... 75 Application Engine Handler ....................................................................................... 76 Create Process ........................................................................................................... 78 Test Operation ........................................................................................................... 79
7.
APPLICATION ENGINE HANDLER ....................................................................................... 74 7.1. 7.2. 7.3. 7.4. 7.5. 7.6.
APPENDIX A PEOPLECODE CALL CI ........................................................................................... 81 APPENDIX B PEOPLECODE CALL EXTERNAL SERVICE ............................................................... 82 APPENDIX C PEOPLECODE CALL CUSTOM PS SERVICE ............................................................. 83 APPENDIX D APPLICATION CLASS CUSTOM PS SERVICE HANDLER.......................................... 84
Page 3 of 84
1. OVERVIEW
1.1. Environment
This training will give you an overview of the basics on Integration Broker. is developed using a PeopleSoft HCM 9.1 with PeopleTools 8.51 environment.
1.2. Aim
Goal of this training is to provide an introduction to the Integration Broker and gaining basic knowledge and hands-on training on integration using web services. This training will also handle how to leverage from non-PeopleSoft tools like SoapUI and JDeveloper.
1.4. Project
Before you start copy from Project IBCOURSE_CUST using Application Designer and build the project! This projects contains sources that you will be using during this training.
Page 4 of 84
Page 5 of 84
Page 6 of 84
Pub/Sub servers are now activated and will start up when the application server starts. Choose option 13 to save the changes in the configuration of the application server. Note option 25) JSL Port is the Jolt port configured that the web server communicates with the application server. Write down the number of this port, you will be needing it later on.
Page 7 of 84
Page 8 of 84
2.2. Enable communication between application application server and web server
During this step you will configure which Integration Gateway will be used by the application server. This is needed for outbound traffic. Start PeopleSoft HCM by starting a browser session and login with user PS and password PS. P Navigate via menu Main Menu > PeopleTools > Integration Broker > Configuration > Gateway.
The Integration Gateway URL is to be constructed as follows: http://[server:port]/PSIGW/PeopleSoftListeningConnector Substitute this URL with your server and port and tab click on Save. The connectors will be loaded as shown in the screen above. Click on the Ping Gateway button to see if the Integration Gateway is up and running. The next screen will show in a new window
2.3. Enable communication unication between web web server and application server
During this step you will tell the Integration Gateway which application server(s) it should communicate with. This is needed for inbound traffic. First we need to find the default local node of HCM. Navigate via menu Main Menu > PeopleTools > Integration Broker > Integration Setup > Nodes On the search page, click on the search button to query all the nodes. After that click on the Default Local Node header of the result grid. The default local node (PSFT_HR) will now be shown as the first node in the list.
Page 9 of 84
Page 10 of 84
Provide an existing PeopleSoft user for Default User ID. It is a good custom to assign a dedicated user for the Integration Broker. If you were to use an active PeopleSoft user and if this user would be locked for whatever reason, all processing of services will be aborted. For the sake of convenience during this training you will use the user PS. It is also a good custom to rename/copy the default local node to an unique node name for your environment. Again for the sake of convenience during this training you will not do this. Navigate via menu Main Menu -> PeopleTools -> Integration Broker -> Configuration -> Gateway
Click on the link Gateway Setup Properties. The following screen will be shown.
Default User ID and Password are administrator/password. Supply these values and click on OK.
Page 11 of 84
In the first section provide the default application server that the Integration Integration Gateway will use to handle messages. Field App Server URL User ID Password Tools Release Value [appserv machine]:[JSL port appserver] PS PS 8.51.04
In the second section provide the default local node and corresponding application server that the Integration Gateway will use. Click on Ping node for the node PSFT_HR. The following screen will be shown.
The Integration Gateway can now successfully communicate with the application server. Click on the Return button and click on the link Advanced Properties Page. The integrationgateway.properties file will now be shown. This file can be found in directory [PS_HOME]\webserv\peoplesoft\ \applications\peoplesoft\PSIGW.war\WEB-INF
Page 12 of 84
You can see that this file now contains the application servers that have been be configured in the PeopleSoft Node Configuration Page. Scroll down in this file and set logging to value 5 ig.log.level=5 With this setting you will enable logging messages and errors in the Integration Broker. The error log en message log og can be found in directory [PS_HOME]\webserv\peoplesoft peoplesoft\applications\peoplesoft\PSIGW.war These file can also be found online using the following URLs File Error Log Message Log URL http://<yourserver>:<port>/PSIGW/errorLog.html /PSIGW/errorLog.html http://<yourserver>:<port>/PSIGW/msgLog.html
In this file scroll down to secureFileKeystorePasswd=password Using the password encrypting section encrypt the password and change this in the file.
Page 13 of 84
Enter desired service and schema namespaces. These will be used in the XSDs and WSDLs as target namespace. You can keep them default as displayed. The field target location refers to the endpoint that services will get. The syntax for this is: http://<server>:<port>/PSIGW/PeopleSoftServiceListeningConnector/[<defaultlocalnode>] http://<server>:<port>/PSIGW/PeopleSoftServiceListeningConnector/[<defaultlocalnode>] Appending the default local node to the target location is not mandatory. Although this is highly recommended if you have multiple environments running on the same PIA PIA/Integration Gateway. Change the field Service System Status to Development. This will enable you to make changes to services without having ing to create new versions every time.
Page 14 of 84
Click on the link Domain Status. The following screen will be shown:
Page 15 of 84
Now check checkbox All Domains Active and click on the button Update and click on the button Refresh.
The Integration Broker is able to process asynchronous services. During the following chapters you will not be using asynchronous services. You can choose to deactivate the Pub/Sub services in the configuration of the application server for performance reasons!
Enter an existing PeopleSoft user in the Default User ID field. Do the same for the WSDL_NODE node.
Page 16 of 84
Click on the plus icon to add a new row. Lets enter a Divorce on 01-01-2011
Enter 01/01/2011 as Effective Date. Select Marital Status as Divorced and set As of to 01/01/2011 and click on the Save button.
Page 17 of 84
Component name is PERSONAL_DATA. Open Application Designer and log in with user/password PS/PS. Choose New Definition -> Component Interface from the menu.
Page 18 of 84
A component interface will be generated for the component PERSONAL_DATA. Save the component interface with a name like CI_PERSONAL_DATA_IBCOURSE.
You have now generated a component interface for a component. Before you generate a web service based on this component interface, you will need to provide access to this component interface.
Page 19 of 84
Click on the Full Access button to provide access to all the component interface method and click on the button OK. Click on Save to save the changes. You will now add the permission list to a new role. Navigate via Main Menu > PeopleTools > Security > Permissions & Roles > Roles and create a new role with name IBCOURSE.
Page 20 of 84
Go to tab Permission Lists and add the permission list IBCOURSE, save the role.
Navigate via Main Menu > PeopleTools > Security > User Profiles > User Profiles and add role IBCOURSE to user PS.
Page 21 of 84
Enter Component Interface Name CI_PERSONAL_DATA_IBCOURSE and click on Search. Select the Component Interface and click on Review CI Status.
Click on the link Select All to select all the Component Interface methods and click on the button Display Selected Actions.
Click on the button Perform Selected Actions. A service will now be generated with the name CI_CI_PERSONAL_DATA_IBCOU with 5 service operations corresponding to the component interface methods.
Page 22 of 84
Take a look at the generated service. Navigate via Main Menu > PeopleTools > Integration Broker > Integration Setup > Services to service CI_CI_PERSONAL_DATA_IBCOU.
Page 23 of 84
You have a service with 5 operations. The 5 operations invoke the 5 CI methods CI Method Create Find Get UpdataData Update Operation _C _F _G _UD _UP Description Create new level0, Search record Add new Search Record Find Existing Get level0 Change existing data Add new rows (level 1,2,3,4, etc)
Page 24 of 84
You have to provide access to this service operation. Click on the link Service Operation Security.
Add Permission List IBCOURSE and provide Full Access. Save the changes.
Check the checkboxes Regenerate Any-to-Local and Generate Local-to-Local. Save the operation. Click on the Handlers tab and check if the handler is set to Active.
Page 25 of 84
Click on the Routings tab and check if the generated routings are active.
Go back to the service definition screen and click on the link Provide Web Service. The next screen will be shown.
Page 26 of 84
Select all operations and click on the button Next. The next screen will be shown.
Click on the link View WSDL to see the generated WSDL. Click on Next and Finish. The web service is now deployed and accessible.
Copy the WSDL URL and paste it in a new browser window. Have a closer look at the WSDL!
Page 27 of 84
Enter the WSDL URL you copied in the previous paragraph and enter this at Initial WSDL/WADL and click on OK. SoapUI will read the WSDL and create request messages for each operation.
Open operation ending with _G by expanding it and double click on Request 1. SoapUI generates the request message based on the WSDL and XSDs and has taken the endpoint from the WSDL where the request will be send to.
Page 28 of 84
Change ? in the request window for EMPLID to value KU0001 and click on the green start icon on the left top corner of the request screen. Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.or g/soap/ envelope/" xmlns:m47="http://xmlns.oracle.com/Enter prise/To ols/schemas/M475651.V1"> <soapenv:Header/> <soapenv:Body> <m47:Get__CompIntfc__CI_PERSONAL_DATA_IB CO URSE> <m47:EMPLID>KU0001</m47:EMPLID> </m47:Get__CompIntfc__CI_PERSONAL_DATA_I BC OURSE> </soapenv:Body> </soapenv:Envelope>
Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.or g/soap/ envelope/" xmlns:soapenc="http://schemas.xmlsoap.or g/soap/ encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSch ema" xmlns:xsi="http://www.w3.org/2001/XMLSch emainstance"> <soapenv:Body> <m47:Get__CompIntfc__CI_PERSONAL_DATA_IB CO URSEResponse xmlns:m47="http://xmlns.oracle.com/Enter prise/To ols/schemas/M1021932.V1"> <m47:EMPLID_0>KU0001</m47:EMPLID_0> <m47:PERS_DATA_EFFDT> <m47:EFFDT_1>2011-01-01</m47:EFFDT_1> <m47:MAR_STATUS>D</m47:MAR_STATUS> <m47:MAR_STATUS_DT>2011-0101</m47:MAR_STATUS_DT> <m47:SEX_0>M</m47:SEX_0> <m47:HIGHEST_EDUC_LVL_0>A</m47:HIGHEST_E D UC_LVL_0> <m47:FT_STUDENT>N</m47:FT_STUDENT> <m47:LANG_CD_0/> <m47:ALTER_EMPLID/> </m47:PERS_DATA_EFFDT> <m47:PERS_DATA_EFFDT> <m47:EFFDT_1>1980-01-01</m47:EFFDT_1> <m47:MAR_STATUS>M</m47:MAR_STATUS> <m47:MAR_STATUS_DT>1980-0101</m47:MAR_STATUS_DT> <m47:SEX_0>M</m47:SEX_0> <m47:HIGHEST_EDUC_LVL_0>A</m47:HIGHEST_E D UC_LVL_0> <m47:FT_STUDENT>N</m47:FT_STUDENT> <m47:LANG_CD_0/> <m47:ALTER_EMPLID/> </m47:PERS_DATA_EFFDT> </m47:Get__CompIntfc__CI_PERSONAL_DATA_I BCO URSEResponse> </soapenv:Body> </soapenv:Envelope>
Congratulations, you have successfully called a web service and retrieved data from PeopleSoft.
Page 29 of 84
Now you can try to change the Marital Status back to Married again by adding a new row with a new Effective Date. Double click on the operation ending with _UP
Double click on Request 1 and SoapUI will generate a request message. Change the request message to the one below and click on the green icon.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m80="http://xmlns.oracle.com/Enterprise/Tools/schemas/M803237.V1"> <soapenv:Header/> <soapenv:Body> <m80:Update__CompIntfc__CI_PERSONAL_DATA_IBCOURSE> <m80:EMPLID>KU0001</m80:EMPLID> <m80:PERS_DATA_EFFDT> <m80:EFFDT_1>2011-01-02</m80:EFFDT_1> <m80:MAR_STATUS>M</m80:MAR_STATUS> <m80:MAR_STATUS_DT>2011-01-02</m80:MAR_STATUS_DT> </m80:PERS_DATA_EFFDT> </m80:Update__CompIntfc__CI_PERSONAL_DATA_IBCOURSE> </soapenv:Body> </soapenv:Envelope>
Remember, you only provided access to the service operation _G and not for the operation _UP. Now add access to all the operations for this service. Log in PeopleSoft. Navigate via Main Menu > PeopleTools > Security > Permissions & Roles > Permission Lists and open permission list IBCOURSE. Click on tab web services.
Page 30 of 84
As you can see you only provided access to operation _G. Click on Full Access (All) to provide access to all the operations and click on the button OK and finally Save. Now go back to SoapUI and invoke the request again. Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"> <soapenv:Body> <m80:Update__CompIntfc__CI_PERSONAL_DATA_IBCOURSEResponse xmlns:m80="http://xmlns.oracle.com/Enterprise/Tools/schemas/M473088.V1"> <m80:notification>1</m80:notification> <m80:detail/> </m80:Update__CompIntfc__CI_PERSONAL_DATA_IBCOURSEResponse> </soapenv:Body> </soapenv:Envelope>
Page 31 of 84
You can see that there are 3 rows for the section Biographical History and that the row you just added through the web service is the most current.
In the messages section click on the link View Message for the Request messages.
Page 32 of 84
You can see this message is a Nonrowset-based message type. If this where a Rowset-based message type you could write PeopleCode using the Record API. In this case you have to create the request message using the XMLDoc API. To see an example of the request that you have to construct in PeopleCode, Navigate via Main Menu > PeopleTools > Integration Broker > Service Utilities > Generate SOAP Template and choose service CI_CI_PERSONAL_DATA_IBCOU. Choose operation CI_CI_PERSONAL_DATA_IBCOU_G. In this screen you can see the structure of the request message that you have to construct
<?xml version="1.0"?> <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing/" xmlns:xsd="http://www.w3.org/2001/XMLSchema/" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance/"> <soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuritysecext-1.0.xsd"> <wsse:UsernameToken> <wsse:Username>PTDMO</wsse:Username> <wsse:Password>PTDMO</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/M475651.V1"> <EMPLID>XYZ</EMPLID> </Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE> </soapenv:Body> </soapenv:Envelope>
The request consists of several parts Soap-Envelope Soap-Header Soap-Body XML content
Page 33 of 84
Integration Broker will automatically generate the Soap parts upon sending the request. You only have to construct the soap-body using PeopleCode. That leaves you with the following message:
<?xml version="1.0"?> <Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE> <EMPLID>KU0001</EMPLID> </Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE>
Open Application Designer and project IBCOURSE_CUST. This project contains a custom page that you will use to invoke and test the web services. Open PeopleCode editor for record IBCOURSE_WS_DER field REQEUST_BTN event FieldChange.
/* Create request message container from operation */ &ReqMsg = CreateMessage(Operation.CI_CI_PERSONAL_DATA_IBCOU_G, %IntBroker_Request); /* Create XMLDOC request */ &XMLDoc = CreateXmlDoc(); &rootNode = &XMLDoc.CreateDocumentElement("Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE"); &childNode = &rootNode.AddElement("EMPLID"); &textNode = &childNode.AddText("KU0001"); /* Set XMLDOC request to message */ &ReqMsg.SetXmlDoc(&XMLDoc); /* Copy constructed request to screen */ &strxml = &XMLDoc.GenFormattedXmlString(); IBCOURSE_WS_DER.IB_SOAPREQ = &strxml;
Copy above code and save the event. Log in to PeopleSoft and Navigate via Main menu > IBCourse > IBCOURSE Call WS and click on the button Call Service.
You can see what your code constructed. Take a closer look at the code.
/* Create request message container from operation */ 1 | &ReqMsg = CreateMessage(Operation.CI_CI_PERSONAL_DATA_IBCOU_G, %IntBroker_Request);
1.
First you created a message object based on the request message of operation CI_CI_DATA_IBCOU_G
Page 34 of 84
/* Create XMLDOC request */ 2 | &XMLDoc = CreateXmlDoc(); 3 | &rootNode = &XMLDoc.CreateDocumentElement("Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE"); 4 | &childNode = &rootNode.AddElement("EMPLID"); 5 | &textNode = &childNode.AddText("KU0001");
2. 3. 4. 5.
Create an empty xml object Set root element to Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSE Add child element EMPLID under root element Assign element EMPLID the value KU0001
7.
7. 8.
Format the constructed xml to a readable xml format Print formatted xml to screen
Now you will extend to code with actually sending the request message and receiving the response message. Copy below code and add this to the existing FieldChange event.
/* Send & receive message */ &ResMsg = %IntBroker.SyncRequest(&ReqMsg); /* Copy response to screen */ &xml = &ResMsg.GetXmlDoc(); &strxml = &xml.GenFormattedXmlString(); IBCOURSE_WS_DER.IB_SOAPRESP = &strxml;
This code will send a synchronous request message through the Integration Broker and receive the response. After this the message body will be extracted and formatted on the screen. Navigate again to your test page and click on the button Call Service. You can see that you now have a response.
The next step is to try to extract specific elements from the response message. First extract the name of the employee and all rows of the marital status that you added in the previous chapters. If you strip the response message from all information that you do not need, then the response looks like this:
Page 35 of 84
<?xml version="1.0"?> <Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSEResponse xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/M1021932.V1"> <NAME>Lewis,Douglas</NAME> <PERS_DATA_EFFDT> <EFFDT_1>2011-01-02</EFFDT_1> <MAR_STATUS>M</MAR_STATUS> <MAR_STATUS_DT>2011-01-02</MAR_STATUS_DT> <SEX_0>M</SEX_0> <HIGHEST_EDUC_LVL_0>A</HIGHEST_EDUC_LVL_0> <FT_STUDENT>N</FT_STUDENT> <LANG_CD_0/> <ALTER_EMPLID/> </PERS_DATA_EFFDT> <PERS_DATA_EFFDT> <EFFDT_1>2011-01-01</EFFDT_1> <MAR_STATUS>D</MAR_STATUS> <MAR_STATUS_DT>2011-01-01</MAR_STATUS_DT> <SEX_0>M</SEX_0> <HIGHEST_EDUC_LVL_0>A</HIGHEST_EDUC_LVL_0> <FT_STUDENT>N</FT_STUDENT> <LANG_CD_0/> <ALTER_EMPLID/> </PERS_DATA_EFFDT> <PERS_DATA_EFFDT> <EFFDT_1>1980-01-01</EFFDT_1> <MAR_STATUS>M</MAR_STATUS> <MAR_STATUS_DT>1980-01-01</MAR_STATUS_DT> <SEX_0>M</SEX_0> <HIGHEST_EDUC_LVL_0>A</HIGHEST_EDUC_LVL_0> <FT_STUDENT>N</FT_STUDENT> <LANG_CD_0/> <ALTER_EMPLID/> </PERS_DATA_EFFDT> </Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSEResponse>
You can see that there is 1 element NAME under the root node and that there is a repeating element PERS_DATA_EFFDT 3 times with the elements EFFDT_1 and MAR_STATUS. You will extract these elements. Append below code to the existing FieldChange.
/* read response */ &aPersonalData = &xml.GetElementsByTagName("Get__CompIntfc__CI_PERSONAL_DATA_IBCOURSEResponse"); If &aPersonalData.len <> 0 Then /* Get Name */ &aName = &aPersonalData [1].GetElementsByTagName("NAME"); If &aName.len <> 0 Then &strName = &aName [1].NodeValue; MessageBox(0, "", 0, 0, "Name: " | &strName); End-If; /* Get Marital Status */ &aPERS_DATA_EFFDT = &aPersonalData[1].GetElementsByTagName("PERS_DATA_EFFDT"); For &i = 1 To &aPERS_DATA_EFFDT.len &strEffDT = ""; &strMaritalStatus = ""; &aEffDT = &aPERS_DATA_EFFDT [&i].GetElementsByTagName("EFFDT_1"); If &aEffDT.len <> 0 Then &strEffDT = &aEffDT [1].NodeValue; End-If; &aMaritalStatus = &aPERS_DATA_EFFDT[&i].GetElementsByTagName("MAR_STATUS"); If &aMaritalStatus.len <> 0 Then &strMaritalStatus = &aMaritalStatus [1].NodeValue; End-If; MessageBox(0, "", 0, 0, "EffDT: " | &strEffDT | " / Marital Status: " | &strMaritalStatus); End-For; End-If;
Page 36 of 84
1.
With method GetElementsByTagName you retrieve the root element from the response message . The return value of this method is an array of nodes. This array of nodes contains all elements of the response message
2 3 4 5 6 7
| If &aPersonalData.len <> 0 Then | &aName = &aPersonalData [1].GetElementsByTagName("NAME"); | If &aName.len <> 0 Then | &strName = &aName [1].NodeValue; | MessageBox(0, "", 0, 0, "Name: " | &strName); | End-If;
2. 3. 4. 5. 6.
Check whether the array of nodes on the root is not empty Retrieve element NAME under root element by &aPersonalData[1] Check whether the array of nodes for NAME is not empty Retrieve value for element NAME Print value of Name to Messagebox
8 | &aPERS_DATA_EFFDT = &aPersonalData[1].GetElementsByTagName("PERS_DATA_EFFDT"); 9 | For &i = 1 To &aPERS_DATA_EFFDT.len 10 | &strEffDT = ""; 11 | &strMaritalStatus = ""; 12 | &aEffDT = &aPERS_DATA_EFFDT [&i].GetElementsByTagName("EFFDT_1"); 13 | If &aEffDT.len <> 0 Then 14 | &strEffDT = &aEffDT [1].NodeValue; 15 | End-If; 16 | &aMaritalStatus = &aPERS_DATA_EFFDT[&i].GetElementsByTagName("MAR_STATUS"); 17 | If &aMaritalStatus.len <> 0 Then 18 | &strMaritalStatus = &aMaritalStatus [1].NodeValue; 19 | End-If; 20 | MessageBox(0, "", 0, 0, "EffDT: " | &strEffDT | " / Marital Status: " | &strMaritalStatus);
Retrieve element PERS_DATA_EFFDT under root element by &aPersonalData [1] Loop through array van nodes (there are 3 indexes) Retrieve node EFFDT_1 under element PERS_DATA_EFFDT by &aPERS_DATA_EFFDT [&i] Check whether the array of nodes on EFFDT_1 is not empty Retrieve value for node EFFDT_1 Retrieve node MAR_STATUS under element PERS_DATA_EFFDT by &aPERS_DATA_EFFDT [&i] Check whether the array of nodes on MAR_STATUS is not empty Retrieve value for node MAR_STATUS Print value of Name to Messagebox
Navigate again to your test page and click on the button Call Service. You will see that the response message is now processed.
Page 37 of 84
SoapUI will read the WSDL. With the right mouse button click on the porttype GetPersonPortType
Page 38 of 84
Leave the name of the Mock Service default and click on OK.
A Mock Service is now created. Double click on the operation GetPerson on the right.
Page 39 of 84
A default Response message will be created. Change the question marks to your own name and userid.
Click on the icon SOAP on the left top corner to create a default request message and set the endpoint of the Mock Service.
Page 40 of 84
In the screen above you can see the that the default request and the endpoint of the Mock Service is setup. You will now run the Mock Service. Go to the Mock Service screen.
Click on the green run icon. The Mock Service is now active.
Click left in the screen on Request 1 and the request screen will show. Now click on the green run icon to invoke the Mock Service and you will see it return a response. You will now import the WSDL of the external system in PeopleSoft and modify the endpoint of the external system to the endpoint of the Mock service. After that you will write PeopleCode to call the service.
Page 41 of 84
Change the values a shown in above screenshot and Save. You will use this node in the following steps.
Page 42 of 84
Select File and click on the button Load from File. Select GetPersonExt.wsdl and click on the button Next.
Page 43 of 84
Select the service operation and click on Next on the third step.
Page 44 of 84
Select Use Existing Node and choose node IBCOURSE_EXT_NODE. Click on Finish.
The service definition of the external service is now imported in PeopleSoft. Click on View Consumed Service to have a closer look at the generated service definition.
Page 45 of 84
Page 46 of 84
Change the Log Detail to Header and Detail. This will enable logging of the messages and errors. Click on de tab Connector Properties.
Change property SOAPUpContent to N. If this property is set to Y, Integration Broker will generate a Soap-Envelope, Soap-Header and a Soap-Body wrapper for the XML message that you will send. In this case you want to create a Soap wrapper using PeopleCode and set the target namespace yourself.
Page 47 of 84
Change the property URL to the endpoint of the Mock Service like this example: http://[domain]:8088/mockGetPersonPortType Note: You will call the endpoint of the Mock Service for test purposes only (on your development environment). On a production environment you will have to set the endpoint back to the endpoint provided in the WSDL of the external service. Save the changes. Before you start writing, lets have a closer look at the generated messages. This will tell you which PeopleCode APIs you should use and how the XML message should be constructed. Go back to the Service Operation and go to section Message Information.
The request message is a Nonrowset-based message. You will have to use the XMLDOC class.
Page 48 of 84
You can see that the Response Message is of type Document. This is a new type introduced in PeopleTools 8.51. You will have to use the PeopleCode class Document for this type.
4.4. PeopleCode
Open Application Designer and the PeopleCode editor for record IBCOURSE_WS_DER field REQUEST_BTN event FieldChange. Add following line above the existing PeopleCode:
If IBCOURSE_WS_DER.IBCOURSE_CALL_TYPE = "C" Then
You will reuse this FieldChange to call the different types of call using the dropdown value of the field IBCOURSE_WS_DER.IBCOURSE_CALL_TYPE.
Page 49 of 84
Login to PeopleSoft and Navigate to the IBCourse test page. Select External for Call WS Type and click on the button Call Service.
Page 50 of 84
You can see that the request is being constructed and send. The Mock Service returned the response you have set. Lets have a closer look at the code.
1 2 3 4 5 6 7 8 9 | | | | | | | | | &Sdoc = CreateSOAPDoc(); &Sdoc.AddEnvelope(0); &EnvNode = &Sdoc.EnvelopeNode; &AddEnvelopeAttribute = &EnvNode.AddAttribute("xmlns:get","http://ibcourse.com/getPerson.wsdl/"); &Sdoc.AddHeader(); &Sdoc.AddBody(); &Sdoc.AddMethod("get:PersonID", 1); &MethodNode = &Sdoc.MethodNode; &textNode = &MethodNode.AddText("12345");
1. 2. 3. 4. 5. 6. 7. 8. 9.
Create a Soap wrapper Add soap-Envelope to the wrapper Get a reference to the envelope node Add custom namespace to envelope Add soap-Header Add soap-body Add root node to soap-body Get a reference to the root node Set vale to root node
You have now constructed a soap message. You will now copy the soap message to the request message.
/* 10 11 12 13 copy SOAP message to input message of service */ | &msg = CreateMessage(Operation.GETPERSON, %IntBroker_Request); | &msg.SetXmlDoc(&Sdoc.XmlDoc); | &strxml = &Sdoc.XmlDoc.GenFormattedXmlString(); | IBCOURSE_WS_DER.IB_SOAPREQ = &strxml;
Create request message for Operation GETPERSON Copy soap message to request message Format XML Print formatted XML to screen
You now have a filled request message. You will now send the request through the Integration Broker and read the response message.
/* 14 15 16 17 18 19 20 21 22 Send & receive message */ | &msg = %IntBroker.SyncRequest(&msg); | &Doc = &msg.GetDocument( True); | &strxml = &Doc.GenXmlString( False); | &XMLDoc = CreateXmlDoc(&strxml); | &strxml = &XMLDoc.GenFormattedXmlString(); | IBCOURSE_WS_DER.IB_SOAPRESP = &strxml; | &Compound = &Doc.DocumentElement; | &Primitive = &Compound.GetPropertyByName("FirstName"); | MessageBox(0, "", 0, 0, & Primitive.Value);
Send request message and receive the response message Copy Document from response Copy XML from Document Create a XMLDOC from XML Format XML Print formatted XML to screen Read root node from response Get node Firstname Print value Firstname to screen
Page 51 of 84
5.1. Messages
First you need to create a request and response message. Navigate via Main Menu > PeopleTools > Integration Broker > Integration Setup > Messages and choose Add New Value.
Choose Rowset for Type and give the message the name IBCOURSE_WS_REQ with Version V1. Click on Add.
Page 52 of 84
You can see the message is based on the record IBCOURSE_WS_REQ. Save the message. Now create a response message in the same manor but with the name IBCOURSE_WS_RES with record IBCOURSE_WS_RES.
Page 53 of 84
5.2. Service
Navigate via Main Menu > PeopleTools > Integration Broker > Integration Setup > Service and choose Add New Value.
Create a Service with name IBCOURSE_CUST_WS and click on the button Add.
Add a description for the service. After that you will create an Operation for this service. In the section Service Operation create a new operation with name IBCOURSE_SYNC_WS with operation Type Synchronous and click on the button Add.
Page 54 of 84
Add a description for the Operation. Check the checkboxes Generate Any-to-Local and Generate Local-to-Local. Select IBCOURSE_WS_REQ.V1 as request message. Select IBCOURSE_WS_RES.V1 as response message. Save the operation.
The Service Operation Security link is now visible. Select this and add Permission List IBCOURSE.
Page 55 of 84
5.3. PeopleCode
You have now created a service and an operation. You can now create the service operation handler code. Open Application Designer and choose New Application Package. Save the Application Package as IBCOURSE_WS_PCK.
Give the Application Class the name IBCOURSE_SYNC_WS. Double click on the Application Class and the Class Editor will be opened. Copy the code below in the Editor and save the code:
Import PS_PT:Integration:IRequestHandler; Class IBCOURSE_SYNC_WS implements PS_PT:Integration:IRequestHandler method OnRequest(&MSG As Message) Returns Message; method OnError(&MSG As Message) Returns string; End-Class; Method OnRequest /+ &MSG as Message +/ /+ Returns Message +/ /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/ Local Rowset &RSReq, &RSRes; Local Message &Response;
Page 56 of 84
Local string &Emplid; &MSG.ExecuteEdits(); If &MSG.IsEditError Then Exit (1); End-If; /* Read Request */ &RSReq = &MSG.GetRowset(); &Emplid = &RSReq(1).GetRecord(1).EMPLID.Value; /* Get Response */ &Response = CreateMessage(Operation.IBCOURSE_SYNC_WS, %IntBroker_Response); /* Get Rowset for response */ &RSRes = CreateRowset(Record.JOB); &RSRes.Fill("where EMPLID =:1", &Emplid); /* Copy like named fields and records to Response */ &Response.CopyRowset(&RSRes, Record.JOB, Record.IBCOURSE_WS_RES); Return &Response; End-Method; Method OnError /+ &MSG as Message +/ /+ Returns String +/ /+ Extends/implements PS_PT:Integration:IRequestHandler.OnError +/ Local integer &msgNumber, &msgSetNumber; Local string &errText; &msgNumber = &MSG.IBException.MessageNumber; &msgSetNumber = &MSG.IBException.MessageSetNumber; &errText = &MSG.IBException.ToString( False); &errText = &errText | " " | &msgNumber | " " | &msgSetNumber; Return &errText; End-Method;
It starts off with importing the base class PS_PT:Integration:IRequestHandler. All synchronous service handlers will have to extend this class. Then you create your own class with the mandatory two methods OnRequest and OnError. The OnRequest method will handle the incoming message and return a response message. The OnError method will be called if the processing of the OnRequest encounters any errors and a Fault message will be returned.
Method OnRequest /+ &MSG as Message +/ /+ Returns Message +/ /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/ Local Rowset &RSReq, &RSRes;
Page 57 of 84
Local Message &Response; Local string &Emplid; &MSG.ExecuteEdits(); If &MSG.IsEditError Then Exit (1); End-If; [] Return &Response; End-Method;
Because your service operation has a request message of type Rowset-based, you can make full use of the PeopleSoft Rowset/Record classes and methods. First you will validate the request message using ExecuteEdits. With this method you can validate all PeopleSoft system edits, like Required Fields, XLAT values or Prompts. You do not have to explicitly code these validations. If the ExecuteEdits faults, then the OnError method of this class is triggered with Error(1). The processing stops and the default response is constructed.
/* Read Request */ &RSReq = &MSG.GetRowset(); &Emplid = &RSReq(1).GetRecord(1).EMPLID.Value; /* Get Response */ &Response = CreateMessage(Operation.IBCOURSE_SYNC_WS, %IntBroker_Response); /* Get Rowset for response */ &RSRes = CreateRowset(Record.JOB); &RSRes.Fill("where EMPLID =:1", &Emplid); /* Copy like named fields and records to Response */ &Response.CopyRowset(&RSRes, Record.JOB, Record.IBCOURSE_WS_RES);
With MSG.GetRowset you can read the rowset from the message in a Rowset object. Now you can read the rowset just as you would when reading the component buffer. After this you can create the Response message object based on the Response message of the operation. Finally you can create a rowset that you will use for the response message.
Give the handler a name like CustomHandler. Select Type On Request. Select Implementation Application Class. Click on link Details.
Page 58 of 84
Add Handler details as shown in the screen above and click on OK. In the Handler screen click on Save to save the changes. Now click on the link Return to Service. You can now deploy the Service.
Page 59 of 84
Click on the link Provide Web Service to start the Deploy wizard.
Click on Finish.
Page 60 of 84
The result screen will show the generated WSDL URL of the deployed service. You will use this WSDL later on and import it in SoapUI to test the service from outside of PeopleSoft. But first you want to test the service from PeopleSoft.
Page 61 of 84
Add KU0001 as value and click on OK. On the next screen click on Invoke Operation and you can see the response is being returned.
Page 62 of 84
Page 63 of 84
You can see that the default request is constructed based on the definition in the WSDL. Modify the request to a simplified request like shown on the next page and click on the green Run button.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ibc="http://xmlns.oracle.com/Enterprise/Tools/schemas/IBCOURSE_WS_REQ.V1"> <soapenv:Header/> <soapenv:Body> <ibc:IBCOURSE_WS_REQ> <ibc:MsgData> <ibc:Transaction> <ibc:IBCOURSE_WS_REQ class="R"> cl <ibc:EMPLID IsChanged="N">KU0001</ibc:EMPLID> </ibc:IBCOURSE_WS_REQ> </ibc:Transaction> </ibc:MsgData> </ibc:IBCOURSE_WS_REQ> </soapenv:Body> </soapenv:Envelope>
Page 64 of 84
The service is now also successfully invoked from outside of PeopleSoft. Now lets write some PeopleCode to call this service from PeopleSoft.
Page 65 of 84
You can notice right away the coding rowset based services is a lot simpler than nonrowset- based services. Log in to PeopleSoft and navigate to the IBCourse test page. Select Custom PeopleSoft WS and click on Call Service
Page 66 of 84
6. TRANSLATIONS
In the previous assignment you have created a service with Rowset-based messages. The use of Rowset-based messages enables you to use PeopleCode objects like Records and Rowsets. Also you can simply use record validations like required fields, prompts or XLAT values without writing additional code. The downside of using Rowset-based messages is that the messages have a lot of unnecessary overhead for non-PeopleSoft systems. Instead of recreating the service, you can make use of translations. Translations can be used to transform XML layout and XML values. In this assignment you will transform the response message using XSLT to a more simplified format.
You will now create a message based on this XSD. Navigate via Main Menu > PeopleTools > Integration Broker > Integration Setup > Messages and choose Add a New Value.
Make a new message like shown in above screenshot and click on Add. Click on the tab Schema.
Page 67 of 84
Enter the XSD and click on Save. You will now create an XLST Application Engine.
Page 68 of 84
Select Action type XSLT and set Graphical Mapper to Yes and save the Application Engine.
Double click on the action XSLT. JDeveloper will start and the XSL Mapper will be shown.
Page 69 of 84
On the left you will see the PeopleSoft Rowset-based message and on the right the new Nonrowsetbased message. You can now map the fields. Create the mapping by dragging and dropping the fields from left to right..
Save the XSL in JDeveloper. The XSLT will automatically be saved in the Application Engine Action. Click on the source tab in JDeveloper XSL and have a closer looks at the XSL that has been created.
<?xml version="1.0"?> <?oracle-xsl-mapper <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -> <mapSources> <source type="XSD"> <schema location="http://<yourserver>:<port>/PSIGW/PeopleSoftServiceListeningConnector/PSFT _HR/IBCOURSE_WS_RES.V1.xsd"/> <rootElement name="IBCOURSE_WS_RES" namespace=""/> </source> </mapSources> <mapTargets> <target type="XSD"> <schema location="http://<yourserver>:<port>/PSIGW/PeopleSoftServiceListeningConnector/PSFT _HR/IBCOURSE_TRANSFORM_RES.V1.xsd"/> <rootElement name="Person" namespace="http://xmlns.oracle.com/Enterprise/Tools/schemas/IBCOURSE_TRANSFORM_RES. V1"/> </target> </mapTargets> <!-- GENERATED BY ORACLE XSL MAPPER 10.1.3.4.0(build 080718.0645) AT [MON JAN 17 20:20:24 GMT 2011]. --> ?> <xsl:stylesheet exclude-result-prefixes="xsl xs ns0 xref xp20 bpws ora ehdr orcl ids hwf" version="1.0" xmlns:bpws=http://schemas.xmlsoap.org/ws/2003/03/business-process/
Page 70 of 84
xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers. ESBHeaderFunctions" xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath" xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath" xmlns:ns0="http://xmlns.oracle.com/Enterprise/Tools/schemas/IBCOURSE_TRANSFORM_RES. V1" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functio ns.ExtFunc" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functio ns.Xpath20" xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPat hFunctions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <ns0:Person> <EmployeeID> <xsl:value-of select="/IBCOURSE_WS_RES/MsgData/Transaction/IBCOURSE_WS_RES/EMPLID"/> </EmployeeID> <StartDate> <xsl:value-of select="/IBCOURSE_WS_RES/MsgData/Transaction/IBCOURSE_WS_RES/EFFDT"/> </StartDate> <FunctionCode> <xsl:value-of select="/IBCOURSE_WS_RES/MsgData/Transaction/IBCOURSE_WS_RES/JOBCODE"/> </FunctionCode> </ns0:Person> </xsl:template> </xsl:stylesheet>
Page 71 of 84
Page 72 of 84
Page 73 of 84
Page 74 of 84
Right click on Step 01 and choose Insert Action Select PeopleCode as type.
Save the Application Engine as IBCOURSE_AEH. Double click on the PeopleCode Action to open the PeopleCode Editor. Copy the PeopleCode below:
Local Rowset &RS; Local Message &MSG; MessageBox(0, "", 0, 0, IBCOURSE_AET.OPRID); MessageBox(0, "", 0, 0, IBCOURSE_AET.RUN_CNTL_ID); /* Get Transaction ID from Integration Gateway which invoked this AE */ &StrTransaction = %IntBroker.GetIBTransactionIDforAE(IBCOURSE_AET.OPRID, IBCOURSE_AET.RUN_CNTL_ID); /* Get message from Integration Gateway belonging to Transaction ID */ &MSG = %IntBroker.GetMessage(&StrTransaction, %IntBroker_SUB); &RS = &MSG.GetRowset(); &Emplid = &RS(1).IBCOURSE_WS_REQ.EMPLID.Value; MessageBox(0, "", 0, 0, &Emplid); /* do processing */
Save the Application Engine. You will now assign this Application Engine as a Handler to the service IBCOURSE_CUST_WS.
Page 75 of 84
In the Service Operations section add a new operation like shown in screen above and click on Add.
In the Message Information add the request message and queue as shown above. Check the checkboxes Generate Any-To-Local and Generate Local-To-Local. Provide access to the operation.
Page 76 of 84
Go to tab Handlers
Enter the handler like shown above and click on link Details.
Enter the Application Engine as the Program Name and click on OK. Go back to the Service screen.
Page 77 of 84
Page 78 of 84
Enter value KU0001 for field Emplid and click on Invoke Operation. Navigate via Main Menu > PeopleTools > Integration Broker > Service Operation Monitor > Monitoring > Asynchronous Services.
Page 79 of 84
You can see the status of the Handler is Done. Lets check if the Application Engine really was initiated. Navigate via Main Menu > PeopleTools > Process Scheduler > Process Monitor.
Click on link Details and click on link View Log/Trace in the next page. Open the stdout file and you can see that Emplid KU0001 is retrieved from the message.
PeopleTools 8.51.04 - Application Engine Server Copyright (c) 1988-2011 Oracle and/or its affiliates. All Rights Reserved PSAESRV started service request at 10.01.19 2011-01-19 PS (0,0) ~GEN~71494795 (0,0) KU0001 (0,0) Application Engine program IBCOURSE_AEH ended normally PSAESRV completed service request at 10.01.20 2011-01-19
Page 80 of 84
Page 81 of 84
Page 82 of 84
Page 83 of 84
Page 84 of 84