Import Value Set Values Using Web Services

As an alternative to using the import option on the Manage Value Sets page, you can use the FndManageImportExportFilesService web service to import value set values into an application. The web service uses the valueSetValuesDataLoader method.

Prerequisite

Ensure that the web service FndManageImportExportFilesService is added to the Manage Application Flexfield Value Set entitlement. Use the Security Console to perform this configuration on Oracle Entitlements Server. While configuring the web service, provide the following details:

  • Resource type: WebserviceResourceType

  • Display name: ImportExport

  • Name: http://xmlns.oracle.com/oracle/apps/fnd/applcore/webservices/FndManageImportExportFilesService#*

  • Entitlement (In Default Policy Domain): Manage Application Flexfield Value Set

  • Security policy: oracle/wss11_saml_or_username_token_with_message_protection_service_policy

Importing Value Set Values

To import value set 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. Access 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. Access 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
    
       parsing WSDL... 
    
       Generating code... 
    
       Compiling code...
  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 desired 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) {
                invokevalueSetValuesDataLoader(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 'VS.txt' which contains ValueSet values data in prescribed format
                byte[] content =
                org.apache.commons.io.FileUtils.readFileToByteArray(new File("/home/user1/VS.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 invokevalueSetValuesDataLoader(FndManageImportExportFilesService fndManageImportExportFilesService,
                                                   Long id) {
            String response;
            try {
                response = fndManageImportExportFilesService.valueSetValuesDataLoader(id);
                System.out.println("Response: " + response);
            } catch (ServiceException e) {
                System.out.println(e.getMessage());
            }
        }
    }
    
  8. Save the generated output as a JAVA file and name it as FndManageImportExportFilesServiceSoapHttpPortClient.java.

  9. Use the JAVA file to build a JAR file, and name it as 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