Calling SOAP Service (ExternalReportService) Directly from VBCS without OIC

 

  • Define the SOAP endpoint as a VB Service Connection
    • In VB, navigate to the Service Connections, create a new connection, and select Define by Endpoint
    • Enter the URL for the service, in this example it is: https://{hostname}/xmlpserver/services/ExternalReportWSSService
    • Configure the service as per the screenshots below:
  • Things to note:
    • Method is POST
    • Authentication is Oracle Cloud Account. The same SAML token as is used for FA REST calls will be used(ref security policy in the WSDL above)
    • Always use the Proxy -this will ensure the call is made from the VB server, thus avoiding CORS errors
    • Add a Request Static Header -Content-Type :'application/soap+xml;charset=UTF-8'
    • Set the request and response example body to{}
  • Note the Service Name and the Endpoint ID. In this example these are - xmlpserverServicesandpostExternalReportWSSService

  • Call the service from a Page Module function
  • The easiest way to demonstrate the connection and confirm it is working is to create a VB page with a Text Area and a Button -the Button will call an action chain that calls the service and maps the response to the Text Area.
Steps:
  • Create a page with a Text Area and a Button
  • Create a Page variable called reportData and bind the Text Area to this variable
  • Create a new Event on the button, and select"Quick Start: ojAction". This will create a listener on the button and an empty Action Chain.
  • Add a reference the the Service Connection to the Application metadata
  • Also add
            "callBIPReportSC": {
                   "path": "./services/callBIPReportSC/openapi3.json"
             }
  • To the application JSON Metadata.

Building Action Chain:

    The Action Chain has 3 steps:

  • First Call Module Function - this function makes payload for the SOAP call. 

//Add the VB REST helper

define(['vb/helpers/rest'], function(Rest) {

'use strict';

var PageModule = function PageModule() {};

PageModule.prototype.callSOAP = function() {

var self = this;

return new Promise(function(resolve, reject) {

//SOAP template, use string substitution to set parameters

var soapTemplate =

'<soap:Envelope xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> \

<soap:Body> \

<pub:runReport> \

<pub:reportRequest> \

<pub:attributeFormat>csv</pub:attributeFormat> \

<pub:reportAbsolutePath>/Custom/AP_INVOICES_VBCS_REPORT/AP_INVOICES_LAYOUT.xdo</pub:reportAbsolutePath> \

<pub:sizeOfDataChunkDownload>-1</pub:sizeOfDataChunkDownload> \

</pub:reportRequest> \

</pub:runReport> \

</soap:Body> \

</soap:Envelope>';

resolve(soapTemplate);

});

};

  • Second call is to read the report output which is in base64 format and covert the same in String using a2b function. The example uses 2 parameters,map these to suit your service based on the report.

PageModule.prototype.readReport = function(pResponse) {

return new Promise(function(resolve, reject){

var xmlResponse = $.parseXML(pResponse);

xmlResponse = xmlResponse.getElementsByTagName("ns2:reportBytes")[0].textContent;

xmlResponse = atob(xmlResponse.split("/")[1]);

resolve(xmlResponse);

});

}

return PageModule;

});

  • Assign Variables - this maps the response from the module function to the reportData page variable
Final Action chain should look like the following:



Comments