• Post category:Web Services
  • Post comments:6 Comments
  • Post last modified:June 16, 2020
  • Reading time:15 mins read
You are currently viewing SOAP Services for performing file operations in UCM
SOAP Services for performing file operations in UCM

In this article we will look into SOAP service used to upload, search, download and delete files from UCM. We will have to base64 encode while uploading the file and base64 decode the file after downloading it as that’s the way how SOAP services work. We will look into how to base64 decode and encode manually and using apis at the end of the article.

Want to learn Fusion Technical tools? Checkout this article

Here is the WSDL that we are going to use to perform these operations of Check in/Search/Download and Delete.

https://{host}/idcws/GenericSoapPort?wsdl

Sample Link:

https://abcd-test.fa.us6.oraclecloud.com/idcws/GenericSoapPort?WSDL

Once we have he WSDL link, we can use either SOAPUI or Postman tools to consume this WSDL and create sample payloads. I am going to demonstrate using SOAPUI today.

let’s get started:

Open SOAP UI and click on File > New SOAP Project

SOAPUI UCM SOAP Project Creation 1 - SOAP Services for performing file operations in UCM
SOAPUI New SOAP Project Landing page

Give some name to the project and add the WSDL link in the “Initial WSDL
It loads the operations and requests in the WSDL onto SOAPUI tool.

You can expand the Operation to see the requests. If you click on the Request button, you an see the sample payload generated for this Service.

SOAPUI UCM Demo Payload - SOAP Services for performing file operations in UCM
GenericSoapOperation Service Sample Payload

Now, we need to provide our user credentials and authenticate in order to continue with out Check in/Search/download and delete operations.

SOAPUI Adding Authentication - SOAP Services for performing file operations in UCM
Adding Authentication to Services

Once you Click on Auth, you will get a popup, click the dropdown and click “Add New Authorization“.

In the next popup select “Basic

SOAPUI Adding Authentication type Basic - SOAP Services for performing file operations in UCM
Authorization type Basic

Select the type as Basic and click OK.
In the next screen enter the Username and Password

SOAPUI Adding Authentication usernamepwd - SOAP Services for performing file operations in UCM

Once you add the Username and Password, you can click on Auth again and he popup will come down. Now that we have added the authentication details, we are ready to send the payload to accomplish our requirement.

Now, we have to prepare the sample payload

Table of Contents

Check-in or Upload new documents:

This request requires the file to be included inline using Base64 encoding.

We can use the online tool https://www.base64decode.org/ to convert file into base64 encoding format

The sample file for this example is very small. A text file called Welcome.txt contains the following text:

Welcome - SOAP Services for performing file operations in UCM
Sample File

Now we will base64 encode this file on https://www.base64encode.org/ website. You can ether copy the content and paste it or upload the file and click on encode.

encode - SOAP Services for performing file operations in UCM
Base64 encoding of file

After encoding it generates the code that we need to use in the payload to upload the file.

Sample Payload for Check-in file to UCM:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.oracle.com/UCM">
<ns1:GenericRequest webKey="cs">
<ns1:Service IdcService="CHECKIN_NEW">
<ns1:User/>
<ns1:Document>
<ns1:Field name="dDocTitle">Welcome</ns1:Field>
<ns1:Field name="dSecurityGroup">FAFusionImportExport</ns1:Field>
<ns1:Field name="dDocType">Document</ns1:Field>
<ns1:Field name="dDocAccount">hcm$/dataloader$/import$</ns1:Field>
<ns1:Field name="xComments">Checkin sample showing file upload using Base64 encoding.</ns1:Field>
<ns1:Field name="primaryFile">Welcome.txt=</ns1:Field>
<ns1:File name="primaryFile" href="C:\Charan\HelloWorld.txt">
<ns1:Contents>V2VsY29tZSB0byBGdXNpb24gSENNIEtub3dsZWRnZWJhc2U=</ns1:Contents>
</ns1:File>
</ns1:Document>
</ns1:Service>
</ns1:GenericRequest>
</soap:Body>
</soap:Envelope>

In the SOAP request, the encoded file must be included in the File and Contents tag. Notice within the contents tag is the encoded version of the file data:

<ns1:Field name=”primaryFile”>Welcome.txt=</ns1:Field>
<ns1:File name=”primaryFile” href=”C:\Charan\HelloWorld.txt”>
<ns1:Contents>V2VsY29tZSB0byBGdXNpb24gSENNIEtub3dsZWRnZWJhc2U=</ns1:Contents>
</ns1:File>

Security category is also one of the important thing while uploading the file to UCM – FAFusionImportExport

Now that the sample payload is created, we will go back to SOAPUI and remove the existing payload, copy and paste this payload and execute the request.

run payload 1 - SOAP Services for performing file operations in UCM

Click Run.

output screen 1 - SOAP Services for performing file operations in UCM
Output screen after the payload is run.

We can see the Content ID in the output.

Let’s navigate to Content Server and check the file using Content ID – UCMFA02534613
Sample Content Server link – https://abcd-test.fa.us6.oraclecloud.com/cs

file uploaded - SOAP Services for performing file operations in UCM
File on UCM

We can see that the file is present on UCM.

Now, lets try the Get File payload to check if it retrieves this file or not.

Sample Payload for Get File using Quick Search functionality:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.oracle.com/UCM">
<ns1:GenericRequest webKey="cs">
<ns1:Service IdcService="GET_SEARCH_RESULTS">
<ns1:Document><ns1:Field name="QueryText">&lt;qsch&gt;Welcome&lt;/qsch&gt;</ns1:Field></ns1:Document>
</ns1:Service>
</ns1:GenericRequest>
</soap:Body>
</soap:Envelope>
search func - SOAP Services for performing file operations in UCM
Search Payload processed and provided the Content ID

Sample payload for Delete Document from UCM

<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="DELETE_DOC">
<ucm:Document>
<ucm:Field name="dDocName">UCMFA02534613</ucm:Field>
</ucm:Document>
</ucm:Service>
</ucm:GenericRequest>
</soapenv:Body>
</soapenv:Envelope>
delete successful 1024x393 - SOAP Services for performing file operations in UCM
Delete file successful from UCM

How to get the document id (dID)?

Once you navigate to the Content Server and open the file that you have uploaded, when you hover over the file name you can see the link will be populated on the footer of the browser.

did - SOAP Services for performing file operations in UCM
Getting the DID from the uploaded file

Sample payload to download file from UCM using dID (Document ID):

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.oracle.com/UCM">
<ns1:GenericRequest webKey="cs">
<ns1:Service IdcService="GET_FILE">
<ns1:User/>
<ns1:Document>
<ns1:Field name="dID">2537354</ns1:Field>
</ns1:Document>
</ns1:Service>
</ns1:GenericRequest>
</soap:Body>
</soap:Envelope>
getfile 1024x509 - SOAP Services for performing file operations in UCM
Downloading file using GET_FILE from UCM

We need to run the payload, in the results screen click on attachments and double click the text under the Name field to open the downloaded file.

Sample Payload to update document info:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.oracle.com/UCM">
<ns1:GenericRequest webKey="cs">
<ns1:Service IdcService="UPDATE_DOCINFO">
<ns1:User/>
<ns1:Document>
<ns1:Field name="dID">3243244</ns1:Field>
<ns1:Field name="dDocName">UCMA23244424</ns1:Field>
<ns1:Field name="xComments">Updated Comments metadata via SOAP request</ns1:Field>
</ns1:Document>
</ns1:Service>
</ns1:GenericRequest>
</soap:Body>
</soap:Envelope>

Sample payload to search results using combination of dDocTitle and a date range for dDocCreateDate

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://www.oracle.com/UCM">
<ns1:GenericRequest webKey="cs">
<ns1:Service IdcService="GET_SEARCH_RESULTS">
<ns1:Document>
<ns1:Field name="QueryText">dDocTitle &lt;starts&gt; `Melville`&lt;AND&gt; dDocCreatedDate &gt; `7/7/15`&lt;AND&gt; dDocCreatedDate &lt; `7/8/15`</ns1:Field>
<ns1:Field name="searchFormType">standard</ns1:Field>
<ns1:Field name="SortField">dDocCreatedDate</ns1:Field>
<ns1:Field name="SortOrder">DESC</ns1:Field>
<ns1:Field name="advSearch">True</ns1:Field>
<ns1:Field name="startRow">1</ns1:Field>
</ns1:Document>
</ns1:Service>
</ns1:GenericRequest>
</soap:Body>
</soap:Envelope>

The Base64 encoded content can be decoded using various methods:
1) Manually, using the online tool available here: https://www.base64decode.org/
2) From a PL/SQL client using the UTL_ENCODE package and the BASE64_DECODE Function: https://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_encode.htm#i996731

Tip: You can use SOAPUP or Postman tool to test the WSDL. If you are getting error, check the authentication details and check if the payload is formatted correctly or not. Sometimes the double quote character might go wrong while you do copy paste. Check it and correct if required.

  • Good Article Sricharan.
    Keep Posting New Articles.

    Could you pleas share the Screenshots for output response of the above article ” Sample payload to search results using combination of dDocTitle and a date range for dDocCreateDate”

    • Hi Viswa,

      Are you facing any issue when you try that?
      I haven’t tried all payloads.. I have tried 4-5 payloads and uploaded the snapshots.
      I have provided other payloads for the ease of use to audience.

      Thanks,
      SM

  • Hi Sri Charan,

    I am trying with you post “Sample payload to search results using combination of dDocTitle and a date range for dDocCreateDate”

    I am not getting proper response.

    I believe date format is dd/mm/yyyy

    Could you please check the below soap request whether i had given correct format or not.

    dDocTitle <starts> `Payroll Relationship.dat`<AND> dDocCreatedDate > `5/5/20`<AND> dDocCreatedDate < `7/8/15`

  • In visible box by plugintheme