PeopleSoft Integration Broker and BPEL (Amazon Web Service)

PeopleSoft Integration Broker and BPEL (Amazon Web Service)

I wanted to integrate PeopleSoft with Amazon web service similar to the one I did before here for Google. But,this time I would like to add BPEL to the mix because that is certainly the way Oracle is taking PeopleSoft in the next version.

It is basically a simple page which will accept a search parameter. Based on the search keyword, the application will go search Amazon web site for books and return the results to PeopleSoft.

Our final PeopleSoft page will look something like this


Amazon WSDL is here.

Prerequisites

  • Before you can use the Amazon web service you need to create an account. You can create a free account for the Amazon web service here. After creating the account for Amazon web you will be provided with Access Key ID, this key is required in order for you to send and receive the messages from Amazon.
  • Since we are going to be integrating the service with BPEL you will need to have JDeveloper (10g, I am still researching how to integrate PeopleSoft with BPEL on JDeveloper 11g) to create the BPEL process and BPEL process manager to deploy the BPEL process developed. You can download them from the oracle web site.
  • Please note that I have made some assumptions regarding the audience who intent to use the steps described below.
      • Knowledge of the PeopleSoft pages, record, application engine and peoplecode.
      • Some working knowledge of the BPEL at least hello world process
      • Some knowledge of XSLT.

Steps

Here are the steps we will follow to create the integration

  1. Create the BPEL process in JDeveoper.
  2. Deploy the process to BPEL process manager.
  3. Test the integration works from BPEL process manager to Amazon.
  4. Configure the PeopleSoft to talk to BPEL process manager
  5. Create a PeopleSoft service operation that consumes the BPEL process we created above.
  6. Create a transform application engine to process the response from Amazon to HTML tags.
  7. Display the response on the PeopleSoft page.
  1. Create the BPEL Process in JDeveloper

  • Create new application in the JDeveloper. Lets us call it PeopleSoftToAmazonV2.

  • Click cancel on the Project create popup.
  • Create new project in the application

  • Select BPEL process project from the projects gallery

    • Select Synchronous BPEL process from the BPEL process creation wizard.

    • Click finish to open the default BPEL process.

    • Since the default BPEL input/output messages take one input and one output we need to change the schema for the input message and output message. Right click on the schema definition and change the schema for input and output as shown below. Amazon item search request needs three mandatory inputs Keywords, ResponseGroup and Searchindex. Since we are going to display total results and Image, Title and price we need these elements in the response message.
    • Create a partner link for the service. Drag the partner link from the component palette on the right side of the BPEL window as shown below.


      • Add invoke activity from the component palette after the receive activity.


    • Connect the invoke activity with the Amazon service by dragging and dropping the invoke activity. Select the itemSearch for the operation from the edit invoke window, auto create the input and output variables.


  • Drag an assign activity in between receive activity and invoke activity. Create copy operations to copy the keywords, search index and response group from in input variable to invoke input variable.




  • Create copy operation to select the access identifier to AWSAccessId. You need to select the expression from the type drop down in the from side of the copy operation.


    • Your final copy operation should look like this


      • Drag another transform activity after the invoke activity


  • Create a transformation double clicking on the transform activity. Make sure source variable is output variable from the invoke activity and target variable is output variable.


    • Map the transformations as follows

      -Add for-each node on the target before the items node .Map tags as follows

      Item/ASIN ———-à ASIN

      – Item/SmallImage/URL———-à ImageURL

      – ItemAttributes/ListPrice/Amount ———-à Price

      – Item/ItemAttributes/Title ——————-àTitle


  1. Deploy the process to BPEL process manager.


    3. Test the service. Logon the BPEL console


    Enter Oracle for keyword, Large for Response Group and Books for search Index.



  2. Configure the PeopleSoft to talk to BPEL process manager

  • Configure the BPEL node properties by changing the process manager URL, BPEL domain. You can get to this screen by clicking on the properties link at the bottom of the Node definitions page


G

5. Create a PeopleSoft service operation that consumes the BPEL process we created above.

  • Get the WDSL from the BPEL Process Manager. Copy the link for the WSDL.

  • Create the service operation using consume web service wizard.

  • Make sure you select the BPEL node you configured before for the WSDL node

  • Note the service operation name. In my case, since I already have an operation named “PROCESS”, wizard created a new unique operation name PROCESS39474. This name is required when you create the code to call the BPEL process.

  • Create a simple page with a button to test our integration so far. Enter the code below behind the field change event of the button.

Local Message &lmsgAmazonRequest, &lmsgAmazonResponse;

Local XmlDoc &lxmldoc;

Local string &lstrXMLString;

&lobjBPEL = create PT_BPEL:BPELUtil();

&lmsgAmazonRequest = CreateMessage(Operation.PROCESS39474, %IntBroker_Request);

&lstrXMLString = “<?xml version=’1.0′?>

<ns1:AmazonItemSearchV2ProcessRequest xmlns:ns1=’http://xmlns.oracle.com/AmazonItemSearchV2′&gt;

<ns1:KeyWord>oracle</ns1:KeyWord>

<ns1:ResponseGroup>Large</ns1:ResponseGroup><

ns1:SearchIndex>Books</ns1:SearchIndex><

/ns1:AmazonItemSearchV2ProcessRequest>”;

WinMessage(&lstrXMLString, 0);

&lxmldoc = CreateXmlDoc(&lstrXMLString);

&lmsgAmazonRequest.SetXmlDoc(&lxmldoc);

&lmsgAmazonResponse = &lobjBPEL.launchsyncBPELProcess(“PROCESS”, &lmsgAmazonRequest, “”, “”);

WinMessage(&lmsgAmazonResponse.GenXMLString(), 0);

  • Test the code. When you the code it should you should see two winmessages as follows one for request and one for response



6. Create a transform application engine to process the response from Amazon to HTML tags.

  • Now that we know our integration works, we need to just make sure our page looks little pretty. We can process the response using SOAPDoc API but it will much easier to do it using XSLT and transform it to HTML tags using XSLT application engine. So create an transform application engine process with the following code. Make sure you change the application engine type to transform in the application engine properties and select XSLT as the transform type.



    Here is the code for the XSLT transform

<?xml version=”1.0″?>

<xsl:transform version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; xmlns:env=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:res=”http://xmlns.oracle.com/AmazonItemSearchV2&#8243; xmlns:ns1=”http://xmlns.oracle.com/AmazonItemSearchV2″&gt;

<xsl:template match=”/”>

<table border=”1″>

<tr>

<td>Total Search Results</td>

<td><xsl:value-of select=”env:Envelope/env:Body/res:AmazonItemSearchV2ProcessResponse/ns1:TotalResults”/></td>

</tr>

<xsl:for-each select=”env:Envelope/env:Body/res:AmazonItemSearchV2ProcessResponse/ns1:Items”>

<tr>

<td><IMG><xsl:attributename=”src”>

<xsl:value-of select=”ns1:ImageURL”/></xsl:attribute></IMG>

<br><xsl:value-of select=”ns1:Price”/></br></td>

<td><xsl:value-of select=”ns1:Title”/></td>
</tr>
</xsl:for-each>
</table>

</xsl:template>

</xsl:transform>

  • Change the routings on the operation to call the transform function.


  • Add HTML object to the page


  • Populate the HTML object the response from the BPEL in the button peoplecode

    Here is final peoplecode behind the button after removing the winmessages we added before and adding line of code to populate the HTML object and changing the hardcoded keyword to accept keyword from the page.

    import PT_BPEL:*;

    Local Message &lmsgAmazonRequest, &lmsgAmazonResponse;
    Local XmlDoc &lxmldoc;
    Local string &lstrXMLString;

    &lobjBPEL = create PT_BPEL:BPELUtil();

    &lmsgAmazonRequest = CreateMessage(Operation.PROCESS39474, %IntBroker_Request);

    &lstrXMLString = “” | MY_AMZN_IB_WRK.PTACEDUMMYFLD3.Value | “LargeBooks”;

    &lxmldoc = CreateXmlDoc(&lstrXMLString);
    &lmsgAmazonRequest.SetXmlDoc(&lxmldoc);
    &lmsgAmazonResponse = &lobjBPEL.launchsyncBPELProcess(“PROCESS”, &lmsgAmazonRequest, “”, “”);

    MY_AMZN_IB_WRK.WSDLHTML.Value = &lmsgAmazonResponse.GenXMLString();

  • Test our final page

And we have our final page.

Later some time, I will try to blog about the direction oracle is going to take the fusion applications with respect to
PeopleSoft and my opinion regarding that based on my review of the JDeveloper preview 4.Until then…..

Advertisements

PeopleSoft Integration Broker and Web Services (Updated)

Thanks for the various comments on my post for the PeopleSoft Integration Broker and Web services. Based on the comments, I noticed that I needed to provide additional information regarding the IB integration with Google web services. I noticed that most of the comments were related to the external system contact error. If you continue to receive this error after following the steps below, it is most likely that some of the configuration were either not done or you are behind a firewall that preventing you from going out of the network.

  1. Configure the integration broker by changing the gateway URL.

 

2.Activate the IB domain. When PeopleSoft is initially installed you will see a lot of invalid IB domains.You can flush out the invalid entries by purging the domain status.

3. When the integration gateway is configured you should see the target connectors in the gateway configuration.

 

 

 

4.Configure the services schemaname and target location. Please note the “Service” in the listening connector. This is PeopleSoftServiceListeningConnector.

 

5.Configure the service using the web service consume wizard.

7.Create a page,record etc to test the integration.

 

8.Enter the following code to test the integration we created.

Local SOAPDoc &SOAPDoc;

 

 

Local XmlNode &lnodeEnvNode;

&SOAPDoc = CreateSOAPDoc();

&SOAPDoc.AddEnvelope(%SOAP_Custom);

&lnodeEnvNode = &SOAPDoc.EnvelopeNode;

&lnodeEnvNode.AddAttribute(“xmlns”, “urn:GoogleSearch”);

&SOAPDoc.AddBody();

&SOAPDoc.AddMethod(“doGoogleSearch”, 1);

&SOAPDoc.AddParm(“key”, “eDZYCx9QFHIXI/xojJqrYspYi1Geo74o”);

&SOAPDoc.AddParm(“q”, “BPEL”);

&SOAPDoc.AddParm(“start”, “0”);

&SOAPDoc.AddParm(“maxResults”, “5”);

&SOAPDoc.AddParm(“filter”, “true”);

&SOAPDoc.AddParm(“restrict”, “”);

&SOAPDoc.AddParm(“safeSearch”, “false”);

&SOAPDoc.AddParm(“lr”, “”);

&SOAPDoc.AddParm(“ie”, “lang_en”);

&SOAPDoc.AddParm(“oe”, “lang_en”);

&lxmlDoc = CreateXmlDoc(&SOAPDoc.GenXmlString());

&lmsgGoRequest = CreateMessage(Operation.DOGOOGLESEARCH);

MY_GOOG_IB_WRK.RAWXML1.Value = &lxmlDoc.GenXmlString();

&lmsgGoRequest.SetXmlDoc(&lxmlDoc);

&lmsgGoResponse = %IntBroker.SyncRequest(&lmsgGoRequest);

MY_GOOG_IB_WRK.RAWXML2.Value = &lmsgGoResponse.GenXMLString();

9. Here is request and response

Request :

<?xml version=”1.0″?>

<SOAP-ENV:Envelope xmlns=”urn:GoogleSearch” xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”><SOAP-ENV:Body><doGoogleSearch><key>eDZYCx9QFHIXI/xojJqrYspYi1Geo74o</key><q>BPEL</q&gt;

<start>0</start><maxResults>5</maxResults><filter>true</filter><restrict/>

<safeSearch>false</safeSearch><lr/><ie>lang_en</ie>

<oe>lang_en</oe></doGoogleSearch>

</SOAP-ENV:Body></SOAP-ENV:Envelope>

Response:

<?xml version=’1.0′ encoding=’UTF-16′?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:xsi=”http://www.w3.org/1999/XMLSchema-instance&#8221; xmlns:xsd=”http://www.w3.org/1999/XMLSchema”&gt;

<SOAP-ENV:Body>

<ns1:doGoogleSearchResponse xmlns:ns1=”urn:GoogleSearch” SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”&gt;

<return xsi:type=”ns1:GoogleSearchResult”>

<directoryCategories xmlns:ns2=”http://schemas.xmlsoap.org/soap/encoding/&#8221; xsi:type=”ns2:Array” ns2:arrayType=”ns1:DirectoryCategory[0]”>

</directoryCategories>

<documentFiltering xsi:type=”xsd:boolean”>false</documentFiltering>

<endIndex xsi:type=”xsd:int”>5</endIndex>

<estimateIsExact xsi:type=”xsd:boolean”>false</estimateIsExact>

<estimatedTotalResultsCount xsi:type=”xsd:int”>1640000</estimatedTotalResultsCount>

<resultElements xmlns:ns3=”http://schemas.xmlsoap.org/soap/encoding/&#8221; xsi:type=”ns3:Array” ns3:arrayType=”ns1:ResultElement[5]”>

<item xsi:type=”ns1:ResultElement”>

<URL xsi:type=”xsd:string”>http://en.wikipedia.org/wiki/Business_Process_Execution_Language</URL&gt;

<cachedSize xsi:type=”xsd:string”>49k</cachedSize>

<directoryCategory xsi:type=”ns1:DirectoryCategory”>

<fullViewableName xsi:type=”xsd:string”></fullViewableName>

<specialEncoding xsi:type=”xsd:string”></specialEncoding>

</directoryCategory>

<directoryTitle xsi:type=”xsd:string”></directoryTitle>

<hostName xsi:type=”xsd:string”></hostName>

<relatedInformationPresent xsi:type=”xsd:boolean”>true</relatedInformationPresent>

<snippet xsi:type=”xsd:string”>As defined in the abstract

of the Web Services &lt;b&gt;Business Process

Execution Language&lt;/b&gt; &lt;br&gt; OASIS Standard

WS-&lt;b&gt;BPEL&lt;/b&gt; 2.0, WS-&lt;b&gt;BPEL&lt;/b&gt;

(or &lt;b&gt;BPEL&lt;/b&gt; for short) is a language for &lt;b&gt;…&lt;/b&gt;</snippet>

<summary xsi:type=”xsd:string”></summary>

<title xsi:type=”xsd:string”>&lt;b&gt;Business Process

Execution Language&lt;/b&gt; – Wikipedia, the free encyclopedia</title>

</item>

<item xsi:type=”ns1:ResultElement”>

<URL xsi:type=”xsd:string”>http://www.ibm.com/developerworks/library/ws-bpel/</URL&gt;

<cachedSize xsi:type=”xsd:string”>28k</cachedSize>

<directoryCategory xsi:type=”ns1:DirectoryCategory”>

<fullViewableName xsi:type=”xsd:string”></fullViewableName>

<specialEncoding xsi:type=”xsd:string”></specialEncoding>

</directoryCategory>

<directoryTitle xsi:type=”xsd:string”></directoryTitle>

<hostName xsi:type=”xsd:string”></hostName>

<relatedInformationPresent xsi:type=”xsd:boolean”>true</relatedInformationPresent>

<snippet xsi:type=”xsd:string”>&lt;b&gt;Business Process Execution Language&lt;/b&gt; for Web Services provides a means to formally &lt;br&gt; specify business processes and interaction protocols.</snippet>

<summary xsi:type=”xsd:string”></summary>

<title xsi:type=”xsd:string”>&lt;b&gt;Business Process Execution

Language&lt;/b&gt; for Web Services version 1.1</title>

</item>

<item xsi:type=”ns1:ResultElement”>

<URL xsi:type=”xsd:string”>http://searchsoa.techtarget.com

/generic/0,295582,sid26_gci1172072,00.html</URL>

<cachedSize xsi:type=”xsd:string”>68k</cachedSize>

<directoryCategory xsi:type=”ns1:DirectoryCategory”>

<fullViewableName xsi:type=”xsd:string”></fullViewableName>

<specialEncoding xsi:type=”xsd:string”></specialEncoding>

</directoryCategory>

<directoryTitle xsi:type=”xsd:string”></directoryTitle>

<hostName xsi:type=”xsd:string”></hostName>

<relatedInformationPresent xsi:type=”xsd:boolean”>true</relatedInformationPresent>

<snippet xsi:type=”xsd:string”>This SearchSOA.com learning guide introduces you to &lt;b&gt;Business Process Execution&lt;/b&gt; &lt;br&gt; &lt;b&gt;Language&lt;/b&gt; for Web services, or BPEL4WS. In this &lt;b&gt;BPEL&lt;/b&gt; learning guide, &lt;b&gt;…&lt;/b&gt;</snippet>

<summary xsi:type=”xsd:string”></summary>

<title xsi:type=”xsd:string”>&lt;b&gt;BPEL&lt;/b&gt; Learning Guide</title>

</item>

<item xsi:type=”ns1:ResultElement”>

<URL xsi:type=”xsd:string”>http://www.oasis-open.org/committees/wsbpel/</URL&gt;

<cachedSize xsi:type=”xsd:string”>25k</cachedSize>

<directoryCategory xsi:type=”ns1:DirectoryCategory”>

<fullViewableName xsi:type=”xsd:string”></fullViewableName>

<specialEncoding xsi:type=”xsd:string”></specialEncoding>

</directoryCategory>

<directoryTitle xsi:type=”xsd:string”></directoryTitle>

<hostName xsi:type=”xsd:string”></hostName>

<relatedInformationPresent xsi:type=”xsd:boolean”>true</relatedInformationPresent>

<snippet xsi:type=”xsd:string”>The purpose of the Web Services &lt;b&gt;Business Process Execution Language&lt;/b&gt; TC was to &lt;br&gt; continue work on the business process language published in the &lt;b&gt;Business&lt;/b&gt; &lt;b&gt;…&lt;/b&gt;</snippet>

<summary xsi:type=”xsd:string”></summary>

<title xsi:type=”xsd:string”>OASIS Web Services &lt;b&gt;Business Process Execution Language&lt;/b&gt; (WSBPEL) TC</title>

</item>

<item xsi:type=”ns1:ResultElement”>

<URL xsi:type=”xsd:string”>http://www.bpelsource.com/</URL&gt;

<cachedSize xsi:type=”xsd:string”>32k</cachedSize>

<directoryCategory xsi:type=”ns1:DirectoryCategory”>

<fullViewableName xsi:type=”xsd:string”></fullViewableName>

<specialEncoding xsi:type=”xsd:string”></specialEncoding>

</directoryCategory>

<directoryTitle xsi:type=”xsd:string”></directoryTitle>

<hostName xsi:type=”xsd:string”></hostName>

<relatedInformationPresent xsi:type=”xsd:boolean”>true</relatedInformationPresent>

<snippet xsi:type=”xsd:string”>A comprehensive &lt;b&gt;Business Process Execution Language&lt;/b&gt; resource guide covering &lt;b&gt;BPEL&lt;/b&gt; &lt;br&gt; process management software, services, information, and news.</snippet>

<summary xsi:type=”xsd:string”></summary>

<title xsi:type=”xsd:string”>BPELSource &lt;b&gt;BPEL&lt;/b&gt; Resource Guide</title>

</item>

</resultElements>

<searchComments xsi:type=”xsd:string”></searchComments>

<searchQuery xsi:type=”xsd:string”>BPEL</searchQuery>

<searchTime xsi:type=”xsd:double”>0.131477</searchTime>

<searchTips xsi:type=”xsd:string”></searchTips>

<startIndex xsi:type=”xsd:int”>1</startIndex>

</return>

</ns1:doGoogleSearchResponse>

 

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>