Import Flexfields, Lookups, or Profile Values Using Web Services

You can import lookups, profile option values, and extensible flexfields into an application using the import function on the application page. Or, you can use the web service FndManageImportExportFilesService for the import task. The web service uses the following methods:

Loader Name

Asynchronous Method

Synchronous Methods

Supported methods for backward compatibility (without UUID)

Flex data uploader

processFlexDataAsync(List<String> inputFileIdTypeList, String UUID)

processFlexData(LIst<String>inputFileIdTypeList, String UUID)

processFlexDataFiles(List<Strig> inputFileIdTypeList)

Lookups data uploader

processLookupsDataAsync(long lookupTypesFileID, long lookupCodesFileID, long viewApplicationID, String UUID)

processLookupsData (long lookupTypesFileID, long lookupCodesFileID, long viewApplicationID, String UUID)

processLookupsUploadFiles (long lookupTypesFileID, long lookupCodesFileID, long viewApplicationID)

User profile values uploader

processUserProfileValuesAsync(long userProfilesFileID, String UUID)

processUserProfileValues(long userProfilesFileID, String UUID)

processUserProfileValuesFile(long userProfilesFileID)

Valueset Values data uploader

processValueSetValuesAsync(Long fileIdAtRepository, String UUID)

processValueSetValues(Long fileIdAtRepository, String UUID)

valueSetValuesDataLoader(Long fileIdAtRepository)

Generic method

NA

downloadProcessLogFile(String UUID)

NA

Example

The following example is about importing the profile values using the web service. To import lookups or extensible flexfields, initiate the web service in the same way as shown here, after replacing the methods and other relevant values in the code.

To import profile values:

  1. Perform the following substeps to generate keystore for the security policy "oracle/wss11_saml_or_username_token_with_message_protection_service_policy":

    1. Generate keystore using the command keytool -genkeypair -keyalg RSA -alias mycompkey -keypass password -keystore mycompclient-keystore.jks -storepass password -validity 3600.

    2. Open the WSDL using the URL http://<host>:<port>/fndAppCoreServices/FndManageImportExportFilesService?wsdl through a web browser, and get the public key <wsdl:service>/<wsdl:port>/<wsa:EndpointReference>/<wsid:Identity>/<dsig:keyInfo>/<dsig:X509Data>/<dsig:X509Certificate>. Then, enclose it with ---- BEGIN CERTIFICATE ---- and ---- END CERTIFICATE ---- and save it to a file by name cdrmpk.cer.

    3. Store the key information in the truststore using the command keytool -importcert -alias cdrmkey -file cdrmpk.cer -keystore mycompclient-keystore.jks -storepass password.

  2. Open the WSDL page using the browser of your choice.

  3. Export and save the associated security certificates Verisign Class 3 Public Primary Certification Authority - G5 and Verisign Secure Server CA - G3.

  4. Use the following command to import the saved certificates into the trust store of the client computer.

    keytool -importcert -keystore <truststore> -storepass <truststorepassword> -file <file location where the mentioned certificate is stored> -alias <alias for certificate>
  5. Run the following command to generate the JAX-WS proxy for the FndManageImportExportFilesService web service.

    C:\Program Files\Java\jdk1.7.0_04\bin>wsimport -s "d:\wsimport\FndManageImportExport" -d "d:\wsimport\FndManageImportExport" http://<host>:<port>/fndAppCoreServices/FndManageImportExportFilesService?wsdl
  6. Save the generated code as a JAR file and name it FndManageImportExportProxy.jar.

  7. Use the following code to create another JAR file to initiate the web service:

    package com.oracle.xmlns.oracle.apps.fnd.applcore.webservices;
     
    import com.sun.xml.ws.developer.WSBindingProvider;
     
    import java.io.File;
    import java.io.IOException;
     
    import java.util.List;
     
    import java.util.Map;
     
    import javax.xml.ws.BindingProvider;
    import javax.xml.ws.WebServiceRef;
     
    import javax.xml.ws.handler.Handler;
     
    import oracle.webservices.ClientConstants;
     
    import weblogic.wsee.jws.jaxws.owsm.SecurityPoliciesFeature;
    // !THE CHANGES MADE TO THIS FILE WILL BE DESTROYED IF REGENERATED!
    // This source file is generated by Oracle tools
    // Contents may be subject to change
    // For reporting problems, use the following
    // Version = Oracle WebServices (11.1.1.0.0, build 130224.1947.04102)
     
    public class FndManageImportExportFilesServiceSoapHttpPortClient
    {
      @WebServiceRef
      private static FndManageImportExportFilesService_Service fndManageImportExportFilesService_Service;
     
      public static void main(String [] args)
      {
           System.setProperty("javax.net.ssl.trustStore","<location of truststore which is used in II) to import the certificates>");
           System.setProperty("javax.net.ssl.trustStorePassword", "<truststore password>");
     
        fndManageImportExportFilesService_Service = new FndManageImportExportFilesService_Service();
            SecurityPoliciesFeature securityFeatures =
                new SecurityPoliciesFeature(new String[] { "oracle/wss11_username_token_with_message_protection_client_policy",
                                                           });
            FndManageImportExportFilesService
     fndManageImportExportFilesService =  
    fndManageImportExportFilesService_Service.getFndManageImportExportFilesServiceSoapHttpPort
     (securityFeatures);
            // Add your code to call the required methods.
     
     
            WSBindingProvider wsbp = (WSBindingProvider) fndManageImportExportFilesService;
               Map<String, Object> requestContext = wsbp.getRequestContext();
     
     
            requestContext.put(ClientConstants.WSSEC_KEYSTORE_TYPE,"jks");
            // Provide location of 'mycompclient-keystore.jks' which was created during Step I)
            requestContext.put(ClientConstants.WSSEC_KEYSTORE_LOCATION,"/home/user1/mycompclient-keystore.jks");
            requestContext.put(ClientConstants.WSSEC_KEYSTORE_PASSWORD,"password");
            requestContext.put(ClientConstants.WSSEC_RECIPIENT_KEY_ALIAS,"cdrmkey");
     
            //Provide user who is having permission to initiate the service
            requestContext.put(WSBindingProvider.USERNAME_PROPERTY,"<username>");
            requestContext.put(WSBindingProvider.PASSWORD_PROPERTY, "<password>");
     
     
            String id =          invokeUploadFiletoUCMMethod(fndManageImportExportFilesService);
     
            if (id != null) {
                invokeUserProfileValuesDataLoader(fndManageImportExportFilesService,  new Long(id));
     
            }
      }
     
        static String invokeUploadFiletoUCMMethod(FndManageImportExportFilesService fndManageImportExportFilesService) {
     
            String response = null;
            DocumentDetails document = new DocumentDetails();
            ObjectFactory objfactory = new ObjectFactory();
            document.setFileName(objfactory.createDocumentDetailsFileName("import_data.txt"));
            // Provide UCM repository - if repository is fin/tax/import then suffix each value with $ as mentioned here
            document.setDocumentAccount(objfactory.createDocumentDetailsDocumentAccount("fin$/tax$/import$"));
            document.setDocumentTitle(objfactory.createDocumentDetailsDocumentTitle("VS"));
            document.setContentType(objfactory.createDocumentDetailsContentType("plain/text"));
     
            try {
     
                // Provide location of bulk import data file in prescribed format
                byte[] content =
                org.apache.commons.io.FileUtils.readFileToByteArray(new File("/home/user1/import_data.txt"));
     
                //System.out.println("File content:" + new String(content, "UTF-8"));
                document.setContent(objfactory.createDocumentDetailsContent(content));
     
            } catch (IOException e) {
                System.out.println(e.getMessage());
            }
            catch(Exception e) {
                System.out.println("Exception: "+e.getMessage());
            }
     
            try {
                response = fndManageImportExportFilesService.uploadFiletoUCM(document);
                System.out.println("Response: " + response);
     
            } catch (ServiceException e) {
                System.out.println(e.getMessage());
            }
     
            return response;
        }
     
        static void invokeUserProfileValuesDataLoader(FndManageImportExportFilesService fndManageImportExportFilesService,
                                                   Long id) {
            String response;
            try {
                response = fndManageImportExportFilesService.processUserProfileValuesFile(id);
                System.out.println("Response: " + response);
            } catch (ServiceException e) {
                System.out.println(e.getMessage());
            }
        }
    }
    
    Note:

    Wherever applicable, replace the values referring to the profile values with those of the lookups or flexfields value sets.

  8. Save the generated output as a JAVA file and name it FndManageImportExportFilesServiceSoapHttpPortClient.java.

  9. Use the JAVA file to build a JAR file, and name it FndManageImportExportClient.jar.

  10. Use the following command to run the web service:

    java -cp ./FndManageImportExportProxy.jar:./ws.api_1.1.0.0.jar:./FndManageImportExportClient.jar FndManageImportExportFilesServiceSoapHttpPortClient

Here's a sample program that's a web service client for the asynchronous method deployFlexAsync(). This client program starts callback client and does the asynchronous call. The required callback web service starts at the line no 58.

Endpoint e = Endpoint.publish(callbackServiceAddress, new ApplicationsCoreSetupServiceResponseImpl());

The callback web service will still be in Running state after the client program execution completes and you need to close it manually. Or, you can also comment the previous line here and run it in a separate client program.

package com.ws.client;

import com.sun.xml.ws.api.addressing.AddressingVersion;
import com.sun.xml.ws.api.addressing.WSEndpointReference;
import com.sun.xml.ws.developer.WSBindingProvider;
import com.sun.xml.ws.message.StringHeader;

import com.ws.client.callback.ApplicationsCoreSetupServiceResponseImpl;
import com.ws.client.types.DeployFlexAsyncResponse;

import java.util.Map;
import java.util.UUID;

import javax.xml.ws.Endpoint;
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceRef;

import oracle.webservices.ClientConstants;

import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;
// !THE CHANGES MADE TO THIS FILE WILL BE DESTROYED IF REGENERATED!
// This source file is generated by Oracle tools
// Contents may be subject to change
// For reporting problems, use the following
// Version = Oracle WebServices (11.1.1.0.0, build 150302.2135.1.30348)

public class ApplicationsCoreSetupServiceSoapHttpPortClient
{
	@WebServiceRef
	private static ApplicationsCoreSetupService_Service applicationsCoreSetupService_Service;


	private static final AddressingVersion WS_ADDR_VER = AddressingVersion.W3C;

	public static void main(String [] args) throws InterruptedException {
		applicationsCoreSetupService_Service = new ApplicationsCoreSetupService_Service();
			SecurityPolicyFeature[] features = new SecurityPolicyFeature[]
				{ new SecurityPolicyFeature("policy:oracle/wss_username_token_client_policy") };

		ApplicationsCoreSetupService applicationsCoreSetupService = applicationsCoreSetupService_Service.getApplicationsCoreSetupServiceSoapHttpPort(features);


		// Get the request context to set the outgoing addressing properties

		WSBindingProvider wsbp = (WSBindingProvider)applicationsCoreSetupService;
			Map<String, Object> requestContext = wsbp.getRequestContext();

			requestContext.put(ClientConstants.WSSEC_KEYSTORE_TYPE, "jks");
			requestContext.put(ClientConstants.WSSEC_KEYSTORE_LOCATION,
											  "/scratch/vgarikip/view_storage/work/keys/mycompclient-keystore.jks");
			requestContext.put(ClientConstants.WSSEC_KEYSTORE_PASSWORD,
												"mypassword1");
			requestContext.put(ClientConstants.WSSEC_RECIPIENT_KEY_ALIAS,
												"cdrmkey");
			requestContext.put(WSBindingProvider.USERNAME_PROPERTY,
												"app_impl_consultant");
			requestContext.put(WSBindingProvider.PASSWORD_PROPERTY, "mypassword1");

			String callbackServiceAddress = "http://<server>:<port>/TestAsyncMani-Project1-context-root/ApplicationsCoreSetupServiceResponseImplPort";
			Endpoint e = Endpoint.publish(callbackServiceAddress, new ApplicationsCoreSetupServiceResponseImpl());

		WSEndpointReference replyTo = new WSEndpointReference(callbackServiceAddress, WS_ADDR_VER);
		String uuid = "uuid:" + UUID.randomUUID();

		wsbp.setOutboundHeaders( new StringHeader(WS_ADDR_VER.messageIDTag, uuid), replyTo.createHeader(WS_ADDR_VER.replyToTag));

	applicationsCoreSetupService.deployFlexAsync("PER_CITIZENSHIPS_DFF", "DFF", false);      //.deployPatchedFlexAsync(mode, pCustomizationId, pCustomizationSetLoc);



		System.out.println("####END OF WS CALL");

		Thread.sleep(10000);

		// Add your code to call the desired methods.
	}
}

Example callback web service start utility if you comment line no 58 in the previous program:

package com.ws.client;


import com.ws.client.callback.ApplicationsCoreSetupServiceResponseImpl;

import javax.xml.ws.Endpoint;


public class RunCallbackServtest {
	public RunCallbackServtest() {
		super();
	}

	public static void main(String[] args) throws InterruptedException {
		RunCallbackServtest runCallbackServtest = new RunCallbackServtest();
		runCallbackServtest.runServ();

	}

	private void runServ() throws InterruptedException {

		System.out.println("$$$$$ BEFORE Server Start ###################");
		String callbackServiceAddress = "http://<server>:<port>/TestAsyncMani-Project1-context-root/ApplicationsCoreSetupServiceResponseImplPort";
		Endpoint e = Endpoint.publish(callbackServiceAddress, new ApplicationsCoreSetupServiceResponseImpl());

		System.out.println("$$$$$ AFTER Server Start ###################");

	}
}