Thursday, 9 April 2020

Mulesoft Integration with Oracle BIP Webservice

Use the following steps to consume Oracle BIP webservice and run the BI report.

  1. Create a mulesoft project called MuleToOracleBIIntegration. 
  2. Add HTTP listener to the flow. 
    • Add Connector configurations. 
      • Host - localhost
      • Port - 8081
      • Base Path - /
    • Specify the path 
      • Path - /bipintegration
    • Go to MIME Type section
      • MIME Type - application/json
    • Go to Advanced section
      • Allowed Method - POST
    • Go to Metadata section
      • Add metadata - Output:Payload
      • Add
      • Give a name - RequestPayload
        • Select Type - JSON
        • Example - Provide sample Json file. 
        • Select
  3. Add Logger
    • Message  - #[payload.elementname]
  4. Add Web Service Consumer 
    • Name - BIP Consumer
    • Connector Configurations
      • Add
      • Give a Name
      • General 
        • Soap Version - SOAP12
        • Wsdl location - https://hostname/xmlpserver/services/ExternalReportWSSService?wsdl
        • Service - ExternalReportWSSService
        • Port - ExternalReportWSSService
      • Transport  -- Note : This is for providing Basic Authentication
        • Transport Configuration : Http transport configuration
        • Request Config: 
          • Add
            • Name : basic-auth
            • Base Path : /
            • Authentication : 
              • Basic Authentication
              • Username
              • Password
      • General : 
        • Operation : runReport
        • Body : payload
  5. Now Add the Transformation before the WebService Consumer 
    • In output section, select  Define metadata option
      • Add
        • Provide a name : BIPResponse
        • Type : XMl
        • Sample : Provide sample response message. 
    • Map the incoming payload to runReport Payload Structure. 
    • Sample :
%dw 2.0
output application/xml
ns ns0 http://xmlns.oracle.com/oxp/service/PublicReportService
---
{
ns0#runReport: {
ns0#reportRequest: {
ns0#parameterNameValues: {
ns0#item: {
ns0#name: "P_REPORT_LAST_RUN_DATE",
ns0#values: {
ns0#item: payload.Parameter1
}
}
},
ns0#reportAbsolutePath: payload.XDO,
ns0#sizeOfDataChunkDownload: -1
}
}
}


  6.  Add Transform message After the web service consumer to get the BI response. 

import * from dw::core::Binaries
output application/xml
ns ns0 http://xmlns.oracle.com/oxp/service/PublicReportService
---
read(fromBase64(payload.body.ns0#runReportResponse.ns0#runReportReturn.ns0#reportBytes),'application/xml')

  7.  Add one more transform if you want to filter the response.


 


Mulesoft REST API with POST Operation.

Use the following steps to expose a REST API with predefined Payload and Consume a REST API with given payload.


  1. Create a mulesoft project called ConsumeRestAPI. 
  2. Add HTTP listener to the flow. 
    • Add Connector configurations. 
      • Host - localhost
      • Port - 8081
      • Base Path - /
    • Specify the path 
      • Path - /postrequest
    • Go to MIME Type section
      • MIME Type - application/json
    • Go to Advanced section
      • Allowed Method - POST
    • Go to Metadata section
      • Add metadata - Output:Payload
      • Add
      • Give a name - RequestPayload
        • Select Type - JSON
        • Example - Provide sample Json file. 
        • Select
  3. Add Logger
    • Message  - #[payload.elementname]
  4. Add Request - HTTP. To consume a target REST API. 
    • Configuration:
      • Add
      • Name : Target Name
      • Base Path : /
      • Protocol - HTTPS
      • Host - target-host-name
      • Port - 443
      • Authentication
        • Basic Authentication
          • Username
          • Password
    • Request :
      • Method : POST
      • Path : REST API URI
      • Body
        • payload - You can modify the payload using DW. 
  5. Add Transform
    • Output
      • output application/json
      • ---
      • payload