Thursday, 28 March 2019

Sample Shell scripts



To Check Folder :


if [ -d "/path/to/dir" ] 
then
    echo "Directory /path/to/dir exists." 
else
    echo "Error: Directory /path/to/dir does not exists."
fi



To Check WSDL :

Status = `curl -Is http://localhost:port/sampleservice?wsdl | head -n 1 | cut -d ' ' -f 2`

It will provide HTTP response code. 


Sample CRL Command to POST XML:

curl -v -X POST --key key_file_name.key -vvv --cert cer_file_name.cer -H "Content-Type: application/xml" -H "Accept: application/xml" --data @XXSCM_ONHAND_AVAILABI_INTG.txt https://hostname:8045/ax.paas/ic/ws/integration/v1/flows/soap/XXSCM_ONHAND_AVAILABI_INTG/1.0/






Oracle Fusion - ERP Web Services and Operations



  1. SAAS Home Page :  https://hostname:443/
  2. SAAS UCM : https://hostname:443/cs
  3. BIP URL  :  https://hostname:443/xmlpserver or analytics
  4. BIP Web Service  :  
    • https://<fusion app url>/xmlpserver/services/ExternalReportWSSService?wsdl
    • https://<fusion app url>/xmlpserver/services/PublicReportWSSService?wsdl
    • https://<fusion app url>/xmlpserver/services/ScheduleReportWSSService?wsdl
    •  Absolute Path :  Provide complete xdo path
    •  Example : /Custom/Financials/int/Reports/samplereport.xdo
  5. ERP Adapter :
    • Service Catalog :
      • https://<fusion app url>/fndAppCoreServices/ServiceCatalogService?wsdl
    • Erp Integration :
      • https://<fusion app url>/fscmService/ErpIntegrationService
    • Event Catalog :
      • https://<fusion app url>/soa-infra
    • Event Configuration 
      • https://<fusion app url>/soa-infra/PublicEvent/catalog
    • Event Subscriber Check:
      • https://<fusion app url>/soa-infra/PublicEvent/subscriptions
  6. Token Relay
    • https://<fusion app url>/fscmRestApi/tokenrelay
  7. Attachment Service 
    • https://<host>.fa.ocs.oraclecloud.com/publicFinancialCommonErpIntegration/ErpObjectAttachmentService?wsdl


HCM Details:


  1. You encrypt files using the Oracle HCM Cloud public key.
  2. The data-loading process decrypts files using the Oracle HCM Cloud private key.
  3. Generate the PGP encryption key pair and download the Oracle HCM Cloud public key to Encrypt the file.  

  •  Submit HCM Data Load
    • Upload File to UCM using following UCM Service. 
      • https://hostname:443/idcws/GenericSoapPort?WSDL
        • Read the file as an attachment
        • Pass the opaque contents to UCM
        • Get the content Id from the response.
        • Service IdcService="CHECKIN_UNIVERSAL"
        • dDocTitle
        • dDocAccount
        • dDocType
        • dSecurityGroup
        • dDocAuthor 
    • Invoke HCM Webservice to Load and Import the data. 
      • https://hostname/hcmCommonDataLoader/HCMDataLoader?WSDL
      • Operation - importAndLoadData
        • Pass the content ID in the request message. -- dDocName from UCM upload response. 
          • <ns0:Field name="dDocName">UCMFA00422909</ns0:Field>
        • Pass the additional Parameters.
    • Get the Status of HDL load and import job. 
      • Operation - getDataSetStatus
        • Pass the content id in the input parameter in the following format. 
          • "ContentId="$UCMContentID
          • Exmple : ContentId=12345
  • To Submit Extract and Get the Output from UCM
    • Submit Extract
      • URL - https://hostname:443/hcmService/FlowActionsService?WSDL
      • Operation 
        • SubmitFlow  - To Submit the job
          • Provide Extract Name 
          • Extract Run ID
        • getFlowTaskInstanceStatus  - To Get the  Status
          • Provide Extract Name
          • Provide Extract Run Id
        • getIntegrationContentId  - To Get the content ID
          • Provide Extract Name
          • Provide Extract Run Id
    • Get the Content from UCM.
      • URL - https://hostname:443/idcws/GenericSoapPort?WSDL
        • Service IdcService="GET_FILE"
        • dDocName = ContentId
      • Decode the Data and Write the file. 
UCM Details:
  • Web Service 
    • URL - https://hostname:443/idcws/GenericSoapPort?WSDL
BIP Webservices:
  • To get the list of Webservices 
    • URL - http://hostname/xmlpserver/services
  • To Schedule a BIP Job.
    • https://hostname/xmlpserver/services/v2/ScheduleService?wsdl
    • Operations
      • scheduleReport - To Submit the Job
      • getScheduledReportStatus - To get the Status of the Job.
      • getAllJobInstanceIDs  - To Get the Job Id's
      • getXMLData  - To Get the XML Data 

Sample Payload : 

HCM Extract : 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowActionsService/types/" xmlns:flow="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowControllerService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:submitFlow>
         <typ:flowName>SAMPLE_EXTRACT_REPORT</typ:flowName>
         <!--Zero or more repetitions:-->
         <typ:parameterValues>
            <flow:ParameterName>Effective Date</flow:ParameterName>
            <flow:ParameterValue>2019-10-17</flow:ParameterValue>
         </typ:parameterValues>
         <typ:parameterValues>
            <flow:ParameterName>LookbackDate</flow:ParameterName>
            <flow:ParameterValue>2019-10-02</flow:ParameterValue>
         </typ:parameterValues>
         <typ:parameterValues>
            <flow:ParameterName>RunDate</flow:ParameterName>
            <flow:ParameterValue>2019-10-17</flow:ParameterValue>
         </typ:parameterValues>    <typ:flowInstanceName>SAMPLE_EXTRACT_REPORT191017084530</typ:flowInstanceName>
         <typ:legislativeDataGroupName>US Legislative Data Group</typ:legislativeDataGroupName>
         <typ:recurringFlag>false</typ:recurringFlag>
      </typ:submitFlow>
   </soapenv:Body>
</soapenv:Envelope>


HCM Get Extract Status :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowActionsService/types/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:getFlowTaskInstanceStatus>         <typ:flowInstanceName>SAMPLE_EXTRACT_REPORT191017084530</typ:flowInstanceName>         <typ:flowTaskInstanceName>SAMPLE_EXTRACT_REPORT</typ:flowTaskInstanceName>
         <typ:legislativeDataGroupName>US Legislative Data Group</typ:legislativeDataGroupName>
      </typ:getFlowTaskInstanceStatus>
   </soapenv:Body>
</soapenv:Envelope>


HCM Get Content ID of an Extract :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/hcm/processFlows/core/flowActionsService/types/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:getIntegrationContentId>         <typ:flowInstanceName>SAMPLE_EXTRACT_REPORT191017084530</typ:flowInstanceName>         <typ:flowTaskInstanceName>SAMPLE_EXTRACT_REPORT</typ:flowTaskInstanceName>
         <typ:legislativeDataGroupName>US Legislative Data Group</typ:legislativeDataGroupName>         <typ:integrationName>IntegrationIdDefinedinExtractDeliveryType</typ:integrationName>
      </typ:getIntegrationContentId>
   </soapenv:Body>
</soapenv:Envelope>


Sample HDL File Load :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/hcm/common/dataLoader/core/dataLoaderIntegrationService/types/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:importAndLoadData>
         <typ:ContentId>12345</typ:ContentId>         <typ:Parameters>ImportMaximumErrors=100,LoadMaximumErrors=100,LoadConcurrentThreads=4,FileEncryption=PGPSIGNED,DeleteSourceFile=N</typ:Parameters>
      </typ:importAndLoadData>
   </soapenv:Body>

</soapenv:Envelope>


UCM Get File
<GenericRequest xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" webKey="cs">
<tns:Service IdcService="GET_FILE">
<tns:User/>
<tns:Document>
<tns:Field name="dDocName">Doc_Id233088</tns:Field>
<tns:Field name="RevisionSelectionMethod">Latest</tns:Field>
<tns:Field name="Rendition">Web</tns:Field>
</tns:Document>
</tns:Service>
</GenericRequest>


UCM Search 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ucm="http://www.oracle.com/UCM">
   <soapenv:Header/>
   <soapenv:Body>
      <ucm:GenericRequest webKey="CS">
         <ucm:Service IdcService="GET_SEARCH_RESULTS">
            <ucm:Document>
               <ucm:Field name="QueryText">dID &lt;MATCHES&gt; `422909`</ucm:Field>
              </ucm:Document>
         </ucm:Service>
      </ucm:GenericRequest>
   </soapenv:Body>
</soapenv:Envelope>


Upload File To UCM:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ucm="http://www.oracle.com/UCM" xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">
   <soapenv:Header/>
   <soapenv:Body>
      <ucm:GenericRequest webKey="cs">
         <ucm:Service IdcService="CHECKIN_UNIVERSAL">
            <ucm:User/>
            <ucm:Document>
               <ucm:Field name="dDocTitle">Department2 Load File</ucm:Field>
               <ucm:Field name="dDocType">Document</ucm:Field>
              <!-- <ucm:Field name="dDocAuthor">test1.user</ucm:Field>
-->
               <ucm:Field name="dSecurityGroup">FAFusionImportExport</ucm:Field>
               <ucm:Field name="dDocAccount">hcm$/dataloader$/import$</ucm:Field>
               <ucm:Field name="primaryFile">sampleFile2.zip</ucm:Field>
               <ucm:File href="sampleFile2.zip" name="primaryFile">                  <ucm:Contents>UEsDBBQACAgIAIZyBVUAAAAAAAAAAAAAAAAQAAAAT3JnYW5pemF0</ucm:Contents>
               </ucm:File>
            </ucm:Document>
         </ucm:Service>
      </ucm:GenericRequest>
   </soapenv:Body>
</soapenv:Envelope>


PGP Commands


Public key (to lock/encrypt the message) and a Private key (to unlock/decrypt the message).

You need to send the public key to all your users so that they can encrypt sensitive messages that they want to send it to you.

 Once you receive an encrypted message, you need to use your private key to decrypt it.


  • Command to generate the key pair. 
             pgp --gen-key "Vijaya User" --key-type RSA --bits 2048 --passphrase "Pass Phrase"
             
            script -q -c "gpg --gen-key" /dev/null
  • Command to list keys. 
            pgp --list-keys
  • export the key using following command.
           pgp --export  $input
           
          input = User Key = "Vijaya User" (from above pgp  generation key)
          input  = Key ID  = This will get generated while creating the key.
  • import pgp key
          pgp  -- import " file_name.asc"

          Reference :  https://linuxaria.com/howto/how-to-easily-encrypt-a-file-with-gpg-on-linux
  • Sample gpg command to decrypt a file :
           gpg --batch --output OUT_PUT_FILE_NAME  --passphrase-fd 0        ENCRYPTED_FILE_NAME.pgp  < pwd.txt

         pwd.txt will have the passphrase.
     
         GPG allows you to bypass prompts with the --batch flag, so we can add that in to our command

        --passphrase-fd 0 tells GnuPG to retrieve the passphrase from input into the current shel

Sample Script to Decrypt:

cat $PassPhrase | gpg --output $OutputFileName --batch --yes --passphrase-fd 0 $SourceFilePath


Sample Script to Enecrypt:

gpg --batch --yes --trust-model always -r $PublicKeyUser -o $OutFilePath -e $SourceFilePath


Friday, 22 June 2018

Sample XSLT to Create Delimited String

1. Map Array to an Element using XSLT

<TargetElement>
    <xsl:for-each select="tns:SourceCollection/tns:SourceElement">
        <xsl:value-of select="." />
        <xsl:if test="position() != last()">
            <xsl:value-of select="','"/>
        </xsl:if>
    </xsl:for-each>
</TargetElement>

Monday, 18 June 2018

GIT Bash Commands to Create New Branch and Merge

1. Clone the existing branch to new folder/branch on your machine.

2. Execute following bash commands

git branch new_branch_name

git checkout new_branch_name

add a new file to branch and execute the following command.

git add .

git commit -m "Creating new branch with additional changes"

git push origin new_branch_name

git branch -a

3.  Merge files from Master/Developer branch to new branch

git checkout new_branch_name

git merge origin/master(developer)

git commit -m "Merging changes from Master to new_branch_name"

git push origin new_branch_name

Monday, 4 June 2018

Mulesoft Anypoint Studio 7.1 - JDK Issue Resolution

1. Install latest vesion of JDK - 1.8
2. Set JAVA_HOME with JDK path
3. Set PATH with %JAVA_HOME%bin
4. Update AnypointStudio.ini under AnypointStudio with following JDK path.

--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-vm
D:\vkanakap\Java\bin\javaw.exe
-vmargs
-Xms512m

Thursday, 24 May 2018

SOACS - ERP CALLBACK IMPLEMENTATION STEPS


ERP CALLBACK IMPLEMENTATION STEPS

    •  Get the user credentials to invoke the SAAS web service
    •  Create a same user in SOACS and password may be anything
    •  Import all SOACS certificates on to ERP servers using security console
    •  Import all SAAS certificates on to SOACS server using EM console.
    • Got to Domain folder in em conole
    • Select Security , Keystore
    • Select System and trust keystore
    • Select Manage option 
    • Import the SAAS certificate
    • Use the following steps to get the SAAS certificate. 
      • Access SAAS URL 
      • Select the lock button in the URL
      • Select certificate
      • Go to details
      • Select copy certificate to file option
      • Use Base 64 Encode format
      • Save the file as *.cer file. 
    • Import SAAS OWSM certificates in SOA EM console
      • Access SAAS WSDL and get the certificates. (Look at the bottom of the WSDL and you will get the certificates
      • https://HostName:port/publicFinancialCommonErpIntegration/ErpIntegrationService?wsdl
      • Copy the certificates and save it as .cer files
      • Open the cer files and get the issuesd to name. 
      • Got to Security and Keystore under domain
      • Create a stripe called owsm
      • Under owsm create a keystore called keystore. 
      • select the keystore and click manage option in the top.
      • import the above owsm certificates with issuer name as alias. ($issuedto.cloud.oracle.com) (CN=$IssuedName, DC=cloud, DC=oracle, DC=com)
    • Create a SOA Composite to invoke ERP service using following WSM policy.
      • Oracle/wss_http_token_over_ssl_client_policy
      • Attach CSF key to the policy.
    • Create a SOA composite to receive the callback from ERP service. Use the following WSM policy to receive the call back.
      • Oracle/wss_saml_bearer_or_username_token_service_policy
Use the following sample xsd and wsdl files to receive the callback message.

<?xml version='1.0' encoding='UTF-8'?>
<schema attributeFormDefault="unqualified" targetNamespace="http://xmlns.oracle.com/SOACoreServices/ERPCallbackServiceService/ERPCallbackService" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="ERPCallbackInput">
<complexType>
<sequence>
<element name="requestId" type="string"/>
<element name="state" type="string"/>
<element name="resultMessage" type="string"/>
</sequence>
</complexType>
</element>
</schema>


<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions
     name="ERPCallbackService"
     targetNamespace="http://oracle.com/sca/soapservice/SOACoreServices/ERPCallbackServiceService/ERPCallbackService"
     xmlns:tns="http://oracle.com/sca/soapservice/SOACoreServices/ERPCallbackServiceService/ERPCallbackService"
     xmlns:inp1="http://xmlns.oracle.com/SOACoreServices/ERPCallbackServiceService/ERPCallbackService"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    >
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://xmlns.oracle.com/SOACoreServices/ERPCallbackServiceService/ERPCallbackService"
                 schemaLocation="../Schemas/ERPCallbackService.xsd"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="onJobCompletionRequestMessage">
        <wsdl:part name="ERPCallbackInput_pn" element="inp1:ERPCallbackInput"/>
    </wsdl:message>
    <wsdl:portType name="onJobCompletion_ptt">
        <wsdl:operation name="onJobCompletion">
            <wsdl:input message="tns:onJobCompletionRequestMessage"/>
        </wsdl:operation>
    </wsdl:portType>
</wsdl:definitions>



Note:   Use the following template to create the certificates. 

-----BEGIN CERTIFICATE----- 
MIIDVzCCAj+p0dBMXCYKcFkw==
-----END CERTIFICATE----- 



Oracle Fusion - Order Management Cross Reference

Summary:  This guide outlines the steps to manage cross-reference data for Sales Order FBDI upload for the source systems,  including export...