Use the WebCenter Content Generic SOAP Web Service to Upload an HCM Data Loader ZIP File

The Oracle WebCenter Content server exposes a SOAP web service interface (GenericSoapPort) that you can use to upload files.

Invoke the WebCenter Content Generic SOAP Web Service with Inline Content

You can send inline content along with your GenericSoapPort web service calls.

Get the WSDL file for the web service from the following location:

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

Host is your Oracle Fusion Cloud Applications URL.

The body of the request includes the following parameters:

Parameter Meaning Comment for HCM Data Loader
IdcService

The service to invoke.

CHECKIN_UNIVERSAL for uploading files

dDocName

The Content ID for the content item.

Value passed to HcmDataLoader

dDocAuthor

The content item author (contributor).

 
dDocTitle

The content item title.

The title of the file as it appears in Import/Export UI

dDocType

The content item type.

Document

dSecurityGroup

The security group, such as Public or Secure.

FAFusionImportExport

dDocAccount

The account for the content item. This value is required only if accounts are enabled.

hcm$/dataloader$/import$

primaryFile

The absolute path to the location of the file as seen from the server.

 

The dDocName value is a part of the response and represents the content ID to be used for further HCM Data Loader processing.

You can optionally use an envelope when sending the request, for example:

<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">Department Load File</ucm:Field>
                    <ucm:Field name="dDocType">Document</ucm:Field>
                    <ucm:Field name="dDocAuthor">YOUR_HCM_USER_NAME</ucm:Field>
                    <ucm:Field name="dSecurityGroup">FAFusionImportExport</ucm:Field>
                    <ucm:Field name="dDocAccount">hcm$/dataloader$/import$</ucm:Field>
                    <ucm:Field name="primaryFile">YourZipFile.zip</ucm:Field>
                    <ucm:File href="YourZipFile.zip" name="primaryFile">
                        <ucm:Contents>hQEMA+8YN513c6VEAQf9EstURU0V2erP9hNIP34P6cvwdi2G8hmtTY4dj+jpjSBiBwF28SzOGO5Q T/S6LDM1lAd9fHDFO4CFTEUkiMiAfa4jCpkh2kjvrV05GYiy9rlYGbgjRa38t0Boj0G8dkZia4kw lD5zloegTb4k9dp2ZXtAkJjVPTlmaVs7wPjqHJOk1Dtj+zUL/Dvq/X+rcmBtnvZ6+gX1r/PSBYsI ANiUK36pUac916p1wrYbePtmLs9rLB8dZTIdKE3pbi3aIKECnqnfXN3Rx8BT3afI2kWA9xEsEBwL XSgD4EUlYY2lWKM0wQrSCIfz1jit4zK+vs1Jp3zP3kSFfMH9h5b70ATYCNLpAXTmolmJxhvg9nPN RbgWGM0jWuVE7tXEVL66s2XJuV6HCyJ+3QDTSS/hEzUorpbaH7gOPdd2d9uIJayseWmgkCLhpgNM Ml4dGGDEL7ISZNKbu39MWvptFC5wrFX/VyB0E3kZF3xJ9dHz5UzVN3hiji6/ZLnUKRI+mpY41gEQ BdLm/WehWRLkF9yWhdkKOK1imBa+oLCeZg2YcCPNVqMaf42atoix9kSR+PCdB46SGnyQ2kvx0z9V t+4A/70psaMEOgPmUciQ/CNoC3vPdDs/G+p8Run/9MHoZoW5o2KpGC1M4j593BulKnfE7JZdYopG b1MS9Vrd6e4Oj3ZD7ISyrf8gEsEhvRu4se0CnAA8W2Fj2u88TOBn/rX+9NMffGwwO040a00N4upV 70xY0I0mvMzPKh4u4kHHQLaV7+fChTHIRCXFjvN2ziyGdSCYxiZ9tfhms39jPp2LxJKPnsV5GgC8 XSqpzxipYjbZjpqvKAu0k9VhIF4vHlGjTbzZuhz/CETs5Aj2LXvJksIBpDq6whUK7/LKR3hmfKXi e4xng6B4TwSEvhvRDY0+V2np1RMxzlqW0W3XNpKYqkS2kjO7vQM65CBAqeQjYAW9p1tE1k1S5G2N 1whW46eYIQvN68SzkCQIsafzoAtgKKYClEwJuxGE004i6AluJ0keWx+ZzXohyIxx8eTiw7vp5PIS tm2WTriBJ/x0gMB9CWfdymOFK9Mf</ucm:Contents>
                    </ucm:File>
                </ucm:Document>
            </ucm:Service>
        </ucm:GenericRequest>
    </soapenv:Body>
</soapenv:Envelope>

However, as HCM Data Loader files are typically large, is recommended to call the web service using Message Transmission Optimization Mechanism (MTOM) with XML-binary Optimized Packaging (XOP). The following request example shows a request payload uploading an HCM Data Loader ZIP file with MTOM/XOP:

POST http://{host}/idcws/GenericSoapPort HTTP/1.1 
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@example.com>"; start-info="text/xml"; boundary="----=_Part_7_163289738.1476693003095" 
SOAPAction: "urn:GenericSoap/GenericSoapOperation"
Authorization: Basic YOUR_AUTHORIZATION_TOKEN 
MIME-Version: 1.0 
Content-Length: 4030385
Host: {host} User-Agent: Apache-HttpClient/4.1.1 (java 1.5) 
Connection: close 

------=_Part_7_163289738.1476693003095 
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" 
Content-Transfer-Encoding: 8bit 
Content-ID:<rootpart@example.com>


        <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>
                <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:UsernameToken wsu:Id="UsernameToken-12345">
                        <wsse:Username>YOUR_HCM_USER_NAME</wsse:Username>
                        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">YOUR_HCM_ACCOUNT_PASSWORD</wsse:Password>
                        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">ckNXKVpwBU01PD2ENXg5nw==</wsse:Nonce>
                        <wsu:Created>2018-07-01T08:30:03.094Z</wsu:Created>
                    </wsse:UsernameToken>
                </wsse:Security>
            </soapenv:Header>
            <soapenv:Body>
                <ucm:GenericRequest webKey="cs">
                    <ucm:Service IdcService="CHECKIN_UNIVERSAL">
                        <ucm:User/>
                        <ucm:Document>
                            <ucm:Field name="dDocTitle">Department Load File</ucm:Field>
                            <ucm:Field name="dDocType">Document</ucm:Field>
                            <ucm:Field name="dDocAuthor">HCM_IMPL</ucm:Field>
                            <ucm:Field name="dSecurityGroup">FAFusionImportExport</ucm:Field>
                            <ucm:Field name="dDocAccount">hcm$/dataloader$/import$</ucm:Field>
                            <ucm:Field name="primaryFile">YourZipFile.zip</ucm:Field>
                            <ucm:File href="YourZipFile.zip" name="primaryFile">
                                <ucm:Contents>
                                    <inc:Include href="cid:YourZipFile.zip" xmlns:inc="http://www.w3.org/2004/08/xop/include" />
                                </ucm:Contents>
                            </ucm:File>
                        </ucm:Document>
                    </ucm:Service>
                </ucm:GenericRequest>
            </soapenv:Body>
        </soapenv:Envelope> 
------=_Part_7_163289738.1476693003095 
Content-Type: application/zip; name=YourZipFile.zip 
Content-Transfer-Encoding: binary 
Content-ID:<YourZipFile.zip> 
Content-Disposition: attachment; name="YourZipFile.zip"; filename="YourZipFile.zip"

 <<< binary content ommitted for brevity>>> 
 	
------=_Part_7_163289738.1476693003095--

About the WebCenter Content Document Transfer Utility Upload Tool

You can use the WebCenter Content Document Transfer Utility programmatically to upload ZIP files toWebCenter Content server.

The oracle.ucm.idcws.client.UploadTool included in the oracle.ucm.fa_genericclient_11.1.1.jar, is the preferred generic SOAP-based transfer utility. It requires the Oracle JRF web service supporting libraries and uses JAX/WS over HTTPS to communicate with the WebCenter Content server. The oracle.ucm.idcws.client.UploadTool is used to upload a file to WebCenter Content that is streamed from a local file.

The generic SOAP-based transfer utility accesses the WebCenter Content server through its GenericSoapPort web service (/idcws/GenericSoapPort) and requires the client to specify a suitable UsernameToken-based Oracle Web Services Manager security client policy.

About the Java Runtime Environment Requirements

Oracle Java 6 SE release 1.6.0_20 is the earliest version of the Oracle Java Runtime Environment that tested successfully with the WebCenter Content Document Transfer Utility tools. Oracle recommends that you use the latest Java 6 SE or Java 7 SE release to ensure that you have the latest bug fixes and security updates applied.

About the Upload Tool Parameters

When you invoke the oracle.ucm.idcws.client.UploadTool, you must provide the following parameters:

  • url: The WebCenter Content server GenericSoapPort web service location, for example: https://<Your_Oracle_WebCenter_Content_Server_URL>/idcws/GenericSoapPort

  • policy: The suitable UsernameToken-based Oracle Web Services Manager security client policy that matches the server's configured service policy such as the oracle/wss_username_token_over_ssl_client_policy or the oracle/wss_username_token_client_policy policies.

  • username: Your Oracle Cloud HCM username.

  • password: Your Oracle Cloud HCM password.

  • primaryFile: The fully qualified path of a local file to upload.

  • dDocAccount: The destination security account.

  • dDocTitle: The document title.

  • dDocName: Use this parameter if you want to version an existing file, by providing the file's dDocName value.

  • checkout: Perform checkout first, if you are adding a new revision. The values for this parameter can be true or false (default).

You can also pass some optional parameters for debugging or silent invocation use cases:

  • version: To print the UploadTool revision and version.

  • ping: To perform a PING_SERVER test to validate the connection URL and credentials.

  • verbose: To configure a verbose output to log full request and response data binders.

  • quiet: To configure minimal log output.

  • silent: To disable log messages.

  • log_file_name: To send the log information to an external file different from System.out.

  • log_file_append: To configure whether the log is appended versus overwritten.

Upload HCM Data Loader Files Programmatically by Using the Generic SOAP Web Service

One of the programmatic options that you have when uploading HCM Data Loader ZIP files is to use the Generic SOAP Web Service API using the Java programming language.

  1. Import these libraries in your Java program:
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.nio.charset.Charset;
    import java.util.ArrayList;
    
    import java.util.List;
    import java.util.Map;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    
    import oracle.stellent.ridc.IdcClientException;
    import oracle.ucm.idcws.client.UploadTool;
    import oracle.ucm.idcws.client.UploadTool.UploadResults;
    import oracle.ucm.idcws.client.bulk.UploadException;
    import oracle.ucm.idcws.client.model.content.CheckinSource;
    import oracle.ucm.idcws.client.model.content.TransferFile;
    import oracle.ucm.idcws.client.model.response.CheckinResponse;
  2. Create a function to upload files to WebCenter Content Server using the Generic SOAP web service:
    public static String uploadFileToUCMwithSOAP(String url, String username, String password, File uploadFile, 
    			String identifier, String dDocName, String dDocTitle, String dSecurityGroup, String dDocAccount, String dDocType) throws Exception {
    		//Insert all the code in the next steps in the body of this function		
    	}
  3. In the body of the function, create a List object that will contain the url, username, password, and the core arguments like the OWSM security policy. For example:
    		List<String> coreArgs = new ArrayList<String>();
    		coreArgs.add("url=" + url);
    		coreArgs.add("policy=oracle/wss_username_token_over_ssl_client_policy");
    		
    		
    		coreArgs.add("username=" + username);
    		coreArgs.add("password=" + password);
    		coreArgs.add("silent=false"); // minimal log output
    		coreArgs.add("verbose=true"); // verbose log output
    
    		List<String> argsList = new ArrayList<String>();
    		argsList.addAll(coreArgs);
    
    		argsList.add("threads=3");
    		argsList.add("throwOnThreadException=false"); // run() will not throw an exception should a thread error
    		
    		String[] uploadArgs = argsList.toArray(new String[0]);
  4. Create an UploadTool object, and setup its initial configuration using the uploadArgs array. For example:
    		UploadTool uploadTool = new UploadTool();
    
    		// Setup the tool's initial configuration from the supplied arguments.
    		boolean terminateEarly = uploadTool.setup(uploadArgs);
    		if (terminateEarly) {
    			throw new Exception("Error with the UCM UploadTool's initial configuration from the supplied arguments, please check arguments and try again.");
    		}
  5. Add the web service parameters and make the request:
    	List < CheckinSource > items = new ArrayList < CheckinSource > ();
    	items.add(new LocalFileSource(identifier, dDocName, dDocTitle, dSecurityGroup, dDocAccount, dDocType,
    	    uploadFile.getAbsolutePath()));
    
    	uploadTool.setCheckinItems(items);
    	UploadResults uploadResults = uploadTool.run();
    	if (uploadResults != null) {
    	    Map < Integer, Exception > failedCheckins = uploadResults.getAllFailedCheckinsKeyedByTaskNum();
    	    Map < Integer, UploadException > failedCheckinsDetailed = uploadResults.getFailedCheckinsKeyedByTaskNum();
    	    for (Map.Entry < Integer, Exception > entry: failedCheckins.entrySet()) {
    	        if (failedCheckinsDetailed.containsKey(entry.getKey())) {
    	            UploadException e = failedCheckinsDetailed.get(entry.getKey());
    	            logger.info("Checkin with task number " + e.getTaskNumber() + " and identifier " +
    	                e.getIdentifier() + " failed with message " + e.getMessage());
    	        } else {
    	            logger.info("Checkin with task number " + entry.getKey() + " failed with message " +
    	                entry.getValue().getMessage());
    	        }
    	    }
    
    	    Map < Integer, CheckinResponse > successfulCheckins = uploadResults.getSuccessfulCheckinsKeyedByTaskNum();
    	    for (Map.Entry < Integer, CheckinResponse > entry: successfulCheckins.entrySet()) {
    	        CheckinResponse response = entry.getValue();
    	        logger.info("Checkin with task number " + response.getTaskNumber() + " and identifier " +
    	            response.getIdentifier() + " succeeded. dID=" + response.getDId() + " dName=" + response.getDDocName());
    
    
    
    	    }
    	}
    	return dDocName; // dDocName is whats used by HDL Import	

    When the request is running each entry is processed separately. All the failed items sent to a logger object appear on one side. All the successful items are verified from the response and logged on the other side. The dDocName which is the content ID is returned in the response and indicates that the file was successfully uploaded to the WebCenter Content server.