Skip to content

PeopleSoft: Outgoing integrations with 3rd party web services

May 1, 2012

I was recently fortunate enough to be able to take PeopleSoft Integration Tools Rel 8.50 course through Oracle University.  The course was very well taught, very informative and gave a good overview of PeopleSoft Integration Broker (and related technologies).   The one whole in the course was the section dealing with third party integrations (aka getting PeopleSoft to talk with outside web services).

The course didn’t go into very much detail about consuming web services and writing code to send call those web services.   I soon discovered that the the PeopleBooks didn’t go into too much detail on the topic either.  So I spent a great deal of time figuring out how to write the PeopleCode that would allow me to call a third party web service.

The initial steps I took were as follows:

The importing of the WSDL went quite smoothly.  I ran into a roadblock when trying to code that would allow me to call (send a request to) the third party web service.  At first I tried the following PeopleCode:

Local SOAPDoc &soapDoc;
Local XmlDoc &xmlDoc;
Local XmlNode &envNode;

&soapDoc = CreateSOAPDoc();
&SOAPDoc.AddEnvelope(%SOAP_Custom);
&envNode = &soapDoc.EnvelopeNode;
&envNode.AddAttribute("xmlns:tem", "http://tempuri.org/");
&soapDoc.AddHeader();
&soapDoc.AddBody();
&soapDoc.AddMethod("HelloWorld");
&xmlDoc = CreateXMLDoc(&soapDoc.GenXMLString());
&rqst = CreateMessage(Operation.UW_OB_HELLOWORLD_RGLR_SY, %IntBroker_Request);
&rqst.SetXmlDoc(&xmlDoc);
&rspn. &IntBroker.SyncRequest(&rqst);

This PeopleCode produced a XML request message that follows:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:tem="http://tempuri.org/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
        <SOAP-ENV:Body>
           <HelloWorld/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The problem is that the Web Service required a message in the following format:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
    <soap:Body>
        <tem:HelloWorld/>
    </soap:Body>
</soap:Envelope>

After playing with the above code for a while I wasn’t able to get PeopleCode to automatically generate a message with the appropriate format.  So I than decided to “manually” create a message in the appropriate message.

The next steps that I took were as follows:

  • Use the XmlDoc class to build the SOAP envelope for the message.
  • Use the XmlNode class to populate the frame of the message.

I then tried the following PeopleCode:

Local XmlDoc &xmlRqst, &xmlRspn;
Local XmlNode &docTypeNode, &headerNode, &methodNode;
Local Message &rqst, &rspn;

&xmlRqst = CreateXmlDoc("");

&envNode = &xmlRqst.CreateDocumentElement("soap:Envelope", "http://www.w3.org/2003/05/soap-envelope");
&envNode.AddAttribute("xmlns:tem", "http://tempuri.org/");

&headerNode = &xmlRqst.DocumentElement.AddElement("soap:Header");
&bodyNode = &xmlRqst.DocumentElement.AddElement("soap:Body");
&methodNode = &bodyNode.AddElement("tem:HelloWorld");

&rqst = CreateMessage(Operation.UW_OB_HELLOWORLD_RGLR_SY, %IntBroker_Request);
&rqst.SetXmlDoc(&xmlRqst);
&rspn = %IntBroker.SyncRequest(&rqst);

This PeopleCode produced a XML request message that follows:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
    <soap:Body>
        <tem:HelloWorld/>
    </soap:Body>
</soap:Envelope>

As you will note the code produced a SOAP message (request) in the appropriate format.   The web service returned a SOAP message (response) in the following format:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <HelloWorldResponse xmlns="http://tempuri.org/">
            <HelloWorldResult>Hello World</HelloWorldResult>
        </HelloWorldResponse>
    </soap:Body>
</soap:Envelope>

PeopleSoft integration broker will peel off the envelope and body tags from the message.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: