Very good example to consume a web service to PeopleSoft from external application using SOAP based message.
This document covers:
1. Setup PeopleSoft node
2. Consume web service using WSDL
3. People Code example
4. Testing XML message on SOAP UI
Original Title
PeopleSoft: Consuming Web Service from external application
Very good example to consume a web service to PeopleSoft from external application using SOAP based message.
This document covers:
1. Setup PeopleSoft node
2. Consume web service using WSDL
3. People Code example
4. Testing XML message on SOAP UI
Very good example to consume a web service to PeopleSoft from external application using SOAP based message.
This document covers:
1. Setup PeopleSoft node
2. Consume web service using WSDL
3. People Code example
4. Testing XML message on SOAP UI
Consuming Web Service (SOAP-based API) from PeopleSoft
What you will need before starting development:
1. SOAP UI Installed 2. WSDL from external system 3. Entity Information Example: a. Entity represents an open job that needs to be filled. b. Entity represents a timecard for a pay period. c. Entity represents a person seeking a job. 4. PeopleSoft PeopleTools 8.48 and above Step1: Create custom WSDL node Navigate to People Tools Integration Broker Integration Setup Nodes Search for default node WSDL_NODE
Select Copy Node from right hand side of the navigation
Give it a valid name and save. Step 2: Consume WSDL Navigate to People Tools Integration Broker Web Services Consume Web Service 1. Copy and paste WSDL from external system in WSDL URL tab or use other options if applicable and click Next
If you get below error:
Your PeopleSoft environment is not setup to handle URL with https:// use http:// For example change: https://api.yoururl.com/webservices/?wsdl to http://api.yoururl.com/webservices/?wsdl 2. On step 2 click Next
3. Step 4 will display number of APIs from WSDL, select all APIs that are applicable to you or you want use in the check box. For Example: You may want to get Employee ID from external system, so API may be something like FINDEMPLOYEE.
4. Step 6, Give valid message names like FindRequest and FindReponse to Request and Response messages. This step is optional.
5. By default WSDL_NODE will be selected, change it to custom node you will created earlier using use existing node option.
Hit Finish! Step 3: PeopleCode to create a request and process reponse: In this example you will create a message request to start a session and publish it to external system, then navigate through the response and get a session key to do additional processing. &msgRequest = CreateMessage(Operation.StartSession, %IntBroker_Request); /* Creating SOAP Request */ &soapReq = CreateSOAPDoc(); &soapReq.AddHeader(); &soapReq.AddEnvelope(%SOAP_Custom); &EnvNode = &soapReq.EnvelopeNode; &EnvNode.AddAttribute("xmlns:soap-env", "http://schemas.xmlsoap.org/soap/envelope/"); &EnvNode.AddAttribute("xmlns:apis", "http://apiservice.yoururl.com/"); /* add method session */ /*Optional credentials to create a session*/ &soapReq.AddMethod("apis:startsession", 1); &soapReq.AddParm("username", "userid"); &soapReq.AddParm("password", "password"); &soapReq.AddParm("apiKey", "your key"); /* call external web service */ &xmlDoc = &soapReq.XmlDoc; &msgRequest.SetXmlDoc(&soapReq.XmlDoc); &msgResponse = %IntBroker.SyncRequest(&msgRequest); WinMessage (&msgResponse.GenFormattedXmlString()); /* process response */ &strResponse = &msgResponse.GenXMLString(); &xmlDocResponse = CreateXmlDoc(&strResponse); /* extract results from response*/ /* session */ &SessionKey = &xmlDocResponse.GetElementsByTagName("session"); If &SessionKey.Len > 0 Then &session = &SessionKey [1].NodeValue; Else &session = "NONE"; End-If;
This example will give you a session key which will be used in further processing of data you want get or manipulate from external system. You can use above peoplecode to publish any request message and process response message as per your requirement by changing below values:
Example: &msgRequest = CreateMessage(Operation.StartSession, %IntBroker_Request); &msgRequest = CreateMessage(Operation.FindEmployee, %IntBroker_Request); &msgRequest = CreateMessage(Operation.UpdateEmployee, %IntBroker_Request); From above peoplecode Winmessage will show you request message sent to external system, as an optional step you can confirm if XML generated is correct using SOAP UI.
Step 3: Verifying XML with SOAP UI:
Go to File New Soap Project from Soap UI
Click OK This will load web service APIs in project area.
Navigate to web service API and maximize the nodes to see all operations available in the WSDL, select the web service you want to test like CreateSession or FindEmployee then copy and paste XML message which you just generated using peoplecode on left side in below window.
Hit the arrow button
Soap UI will send request message and display response on the right hand side window.
If your XML is good it should return the expected results or will display errors like below.
Tip: Use People Books for more examples on PeopleCode to create soap request.