zondag 25 september 2016

Autoinvoice Import Fusion R11

In the past we've been using Autoinvoice import for importing receivables invoices. You fill the RA_INTERFACE_LINES_ALL table and the RA_INTERFACE_DISTRIBUTIONS_ALL as well if you want to create your own distributions and run Autoinvoice Import to validate and import your transactions.

In Fusion we have several options to do the same.

First we have the File Based Loader option. We can use this option manually (for conversion for example) or create a process in your middleware layer to construct the zipped CSV and upload it to UCM for processing.

Information on how to use the file based data import can be found in the Oracle Enterprise Repository (http://docs.oracle.com/cloud/latest/financialscs_gs/OEFBF/AutoInvoice_Import_4016_fbdi_1.htm#4016). You can download the excel template there as well.

In our case we however wanted to use the web services that are available. We have been investigating the services processInterfaceLine and processInterfaceDistribution next to createSimpleInvoice.
The latter can be used to directly create an invoice, but it's, as the service already says, a simple invoice with a header and some lines.

You can also use the createInterfaceLine or processInterfaceLine to create one or multiple lines in the open interface table.

Transaction Flexfield
Important is how to pass the correct context for grouping of the invoices. Usually you create a new transaction descriptive flex field context for each of your imported invoices.
You pass these in the element TransactionInterfaceLineDff.

 <inv:TransactionInterfaceLineDff xsi:type="ns3:CPQCloud" xmlns:ns3="http://xmlns.oracle.com/apps/flex/financials/receivables/transactions/autoInvoices/TransactionLineInterfaceLineDff/">
               <ns3:__FLEX_Context>CPQ Cloud</ns3:__FLEX_Context>

In order to use these elements you have to check your setup for the API Names of the context and the segments in your context. Check your setup in Manage Descriptive Flexfields. Search for flex field code RA_INTERFACE_LINES.

Open your context and note the API Name for the context.
Each element also has an API name which you must use in the flex field.

Line flex field
The line descriptive flex field can be passed in the element TransactionLineDff. Here the elements equal the API names again of the flex field attributes. For example an attribute for Service Type could be passed using <tran5:serviceType>...</tran5:serviceType>

Header flex field 
One thing we encountered is that although the createSimpleInvoice service contains a transaction header, and thus the transaction header flex field, but the processInterfaceLine service does not have this element. So currently (R11) it does not seem to be possible to pass the header flex field using this service.

Another thing we encountered is that using the processDistributionLine does not contain elements to pass the individual segments for your accounting structure. It only accepts the code combination id. This means we either have to keep a duplicate record of the code combinations to be able to pass the internal id or we fetch the code combination first using a service.

Now there is no standard webservice to fetch the code combination id using the segments and chart of accounts id, so we need to create our own BI report/query to fetch the code combination given the segments and pass that ID to our processInterfaceDistribution service.

A detailed explanation on how to achieve this can be found in this blog http://hakanbiroglu.blogspot.nl/2014/11/leverage-power-of-bi-publisher-in-cloud.html#.V-gR6Ds5ZHQ.

Note that you have to decode the output of the XML from Base64 before you can use the XML that is retrieved.

Submit Autoinvoice Import
Now you can either schedule the Autoinvoice process or submit it from your middle layer. To find the job package name you need to pass navigate to Manage Custom Enterprise Scheduler Jobs for Receivables and Related Applications.

If you open it you will see the name AutoInvoiceMasterEss and the path /oracle/apps/ess/financials/receivables/transactions/autoInvoices/Receivables

When you call the ERP Integration service you pass parameters for example as follows

<?xml version="1.0" encoding="UTF-8" ?>
        <businessunit>{BU Id}</businessunit>
        <paramList>{Your transaction source}</paramList>

Usage notes on the invoice service

dinsdag 26 juli 2016

Oracle Time and Labor in the Cloud and complex overtime rules

During on of our projects we were implementing Oracle Time and Labor in the cloud using quite complex overtime rules. Depending on your schedule and time entered, the system should calculate different buckets for your overtime ranging from 100% time for time, 120%, 125%, 140%, 150%, 175%, 200% and 220%.
All calculated overtime should be transferred to absence management so you can use it as time for time. We were not using Projects, but Payroll time cards (without actual payroll integration).

In order to set this up in Cloud you need to do the following steps and please note we are using R11!

Step 1: Enable Payroll using Setup and Maintenance, Manage Features by Country or Territory

In our case for The Netherlands we've set it to Payroll. This does not mean you have to pay Payroll license, but you can setup Payroll Time Types.
Only if you enable this you will be able to define payroll time types with Hours x Rate!

Step 2: For each overtime element we want to use navigate to Setup and Maintenance, Manage Elements and create a new element under actions.

Note that the category seems to differ between different releases. In R10 you did not have the Timecard category and you should choose Standard, in R11 you do have two options, but make sure you choose Standard.
Now enter the following information for the element. Make sure the effective date is 1-1-01 for example.

On the next page you choose the calculation method. Only Hours x Rate and Days x Rate appear on the timecard.

Choose next and the element is created.

Step 3: Create element eligibility. On the element created navigate to the Element Eligibility and choose Actions, Create Eligibility.

Step 4: Navigate to the menu menu and choose Payroll, Checklist.
On the right side of the screen choose the icon and Submit a Process or Report.

Choose your legislation and the process Create Time Card Calculation Components.

In the parameters you can choose the elements that are not yet created (so your Overtime X from above). Choose submit.

Step 5: Now the system has created a new element Overtime X CIR. Navigate back to Manage Elements, find the element and set the Element Eligibility like we did for the original element.

Step 6: Navigate to Setup and Maintenance, Define Time and Labor.
Now choose Generate Data Dictionary Time Attributes.

Choose your legislation and make sure you choose Yes for Include Payroll Time Types.

Step 7: Now the new payroll time type will appear in your list on your timecard (if your timecard layout has been setup correctly of course). In our case we wanted the user to enter 'Regular Time' and split the timecard (explosion) to different overtime types, but the user should not be allowed to choose the overtime types manually in the list.
In order to do that you have to define a multiple attribute time card field that we will use on our time card layout.
Navigate to Setup and Maintenance, Define time and labor, manage layout components.
Create a new type. The setup is described here as well

So you define a new type and add the payroll time types you ARE allowed to enter. Important are the filters and the settings at the bottom.

Here you specify the default, but also to show the list as a smart choice list. And the filters are setup for the payroll time types based on assignment and start time.

Step 8: So the base is setup now. To understand the setup for OTL take a look at the following diagram.

So there are two parts we need to setup: the layout and the processing. In our example I only added the time calculation rule and no time entry rules (like max your scheduled hours, etc).
Let's first take a look at the layout.

Step 9: Navigate to Setup and Maintenance, Define Time and Labor and choose Manage Time Layout Sets. In our case we create a new layout set based on Payroll.

You have different layouts used for different purposes, but if you change one it usually asks to copy the changes to the other layouts. Make sure if you want that or not.

In our case we want the user to enter time using start and end time, but show calculated hours on the calculated sheet. So the Time Entry Layout is setup as follows

Here we change the default Payroll Time Type to our Restricted time type. We display only start and end time and do not span across midnight.
Note that how the hours are entered is determined by the user's profile setting. We use HH:mi to make sure you can enter 18:00 - 23:00 etc. Otherwise you have to specify AM or PM for example, but this may be valid for other clients of course.

Note that we also did not manage to enter 00:00 (midnight), because it always assumed this was the beginning of the day rather than the end, so we allow users to enter 23:59 and correct this in the time calculation rule to midnight.

The layout for the calculated time shows Payroll Time Types and Hours instead of the restricted list and start/end times. This way it will show our overtime elements in calculated hours.

I will not describe setting up the entry profile here and relating it to your HCM Group, but that is a step you have to do as well of course.
Next is how we setup the time calculation rules.

Step 10: Navigate to Setup and Maintenance, Define time and Labor, Manage Fast Formula.
Our next step is to define the actual formula that is going to do the overtime split.

The first part is mostly copied from the default overtime rule

   |                Copyright (c) 2016 Profource                          |
   |                  Rotterdam                                           |
   |                        All rights reserved.                          |
 * Formula Type:  Time Calculation Rules
 * Description:   Calculates overtime split into buckets.
 * Detail:        Compares the start and end time for the detailed entries  
 *                to the defined time schedule. Splits according to 
 *                rules into different overtime buckets.
 *  Change History
 *  -------------- 
 *  Who               Ver         Date          Description
 *-----------------  ------      ------------  -----------------------------------------
 * Pam Koertshuis     2016.01      2016-JUL-12 Initial creation
 default for measure(number)  is  0  
 default for PayrollTimeType(text) is  'NULL' 
 default for StartTime(Date)  is   '01-JAN-1900'(DATE)  
 default for StopTime(Date)   is  '01-JAN-1900'(DATE)   

  measure(number) ,

paytypeIn = PayrollTimeType
blankDate =  '01-JAN-1900'(DATE) 
ffName = 'XXVTTI_HCM_FF_CALC_OVERTIME  -v2016.01'

NullDate     =  '01-JAN-1900'(DATE) 
NullDateTime = '1900/01/01 00:00:00' (date) 
NullText =  '***NULL***'

rule_id = GET_CONTEXT(HWM_RULE_ID,  0)  

 /* Get context, inorder to makt available for util formula) */
ctx_start_date = GET_CONTEXT(HWM_CTX_SEARCH_START_DATE,  NullDate)
ctx_end_date = GET_CONTEXT(HWM_CTX_SEARCH_END_DATE, NullDate) 

one_minute = 1 / (60 * 24)

/* Since we cannot enter 24:00 we interpret 23:59 as 24:00 */
IF (to_char (ctx_end_date,'HH24:MI') = '23:59')
  rLog  = add_rlog (ffs_id, rule_id,   'Wait a minute ... '  )
  ctx_end_date = add_days (ctx_end_date,one_minute)
  new_measure  = (((days_between(ctx_end_date, ctx_start_date ))*24*60*60)/3600)

So this gets the context and adds a minute to midnight. In our case we want to execute for each detail record, because it depends on the payroll time type entered how overtime is calculated. We have Regular Time, Education, specific shift types, etc.

So to check this, we use something like this

IF (rec_position = 'DETAIL' and (PayrollTimeType = 'Regular Time' or PayrollTimeType = 'Education'))

Now our ruling depends on whether it's a public holiday or not. So we add a call to a function to determine if today or tomorrow is a public holiday (in our case a public holiday starts at a certain time the previous day).

  , starttime > 'Start_Time'
  , l_today < 'ToDayHoliday' DEFAULT FALSE
  , l_tomorrow < 'TomorrowHoliday' DEFAULT FALSE 

Now depending on your rules you could add things like

  l_day = to_number (to_char (StartTime,'D'))
  G_SUNDAY = 1  
  G_MONDAY = 2
  G_FRIDAY = 6

  G_TRUE                = 1
  G_FALSE               = 0

IF (l_day = G_SUNDAY OR l_today = G_TRUE)
  x_overtime_100 = new_measure


x_total = x_overtime_100 * 2 +
          x_overtime_50 * 1.5 +
          x_overtime_25 * 1.25 

So, what this would do is if it today is a sunday or today is a public holiday your time gets rewarded by 100% (so 1 hour results in 2 hours off). At the end you can calculate the total based on your separate components.

Now depending on what you want to see eventually in your exploded time card you add the outputs like

RETURN x_overtime_25, x_overtime_50, x_overtime_100, x_total

Step 11: When you are happy with your formula, we will define the Time Repository Rule template. Here you give the type and the formula you've just created.

Now you can enter the name.

We also want it to fire when you save and on detail level (each entered record).
Now the system will prompt you with the inputs from the formula. The default example of the Shift Premium Calculation uses a time range to determine when overtime is calculated. We did that differently, because we checked his schedule and if your time was written after the schedule you get overtime rewarded.
To fetch the schedule we slightly changed the HCM_WFM_UTIL_GET_EMPLOYMENT_SCHEDULE to fetch both schedule time/start ranges next to the total hours (which it default returns).

The actual percentage depends on when time was entered. For example:
If your schedule is 09:00 - 17:00 and you work
17:00 - 23:00 - you get 100%
23:00 - 07:00 - you get 150%
07:00 - 09:00 - you get 125%
But rules on saturday and sunday and public holidays are different. And this is for regular time and education. There are also other time types you can enter, which get rewarded differently.
And in our case it also depends in which group you fall. So for people from city X the overtime calculations were different.

So .. in our case, the formula did NOT have any input parameters :-).
Then for the output parameters add the grouping and the time attribute to Measure.

For each element we also add an OUT_{..} column with time attribute PayRollTimeType.

Now enter the rest of the information like the message. For example

Assigns regular time to {OUT_REGULAR} and splits overtime to {OUT_OVERTIME100} for 100% time for time, {OUT_OVERTIME120} for 120%, {OUT_OVERTIME140} for 140%, {OUT_OVERTIME200} for 200%, {OUT_OVERTIME220} for 220% with the total calculated in {OUT_TOTAL}.

IMPORTANT: You cannot change the template and rules after you've set them up and you cannot save in between :-(.

Step 12: Now we setup the Rule itself. Here we specify the actual values for the parameters we defined on the template.

Again, you cannot make changes later or add outcome, etc.

Step 13: Now we have our rule complete, we only have to add it to a rule set and attach that rule set to our time processing profile.

Navigate to Setup and Maintenance, Define time and Labor, Manage Time Repository Rule sets. Define a new ruleset with date 1-1-50 and add your rule to it. Relate it to the appropriate HCM Group and make sure you set the priority on top (so it overrules the default Payroll catch all groups).

In Manage Worker Time Processing Profile you bring all the things together (also take a look again at the diagram in the beginning). You specify your consumer set, your period and your time calculation rule set and/or time entry rule set (which we did not setup in our case).

Step 14: When the user enters time, the timecard is automatically split.

So some other considerations ..

  • You don't need to add Regular Time as output of your fast formula like we did here (which were hours within schedule). 
  • You can show all the different elements to clarify how the amount was calculated, or only add a Overtime as total of course (calculated by the individual components).
  • Any formulas you create to support your time calculation formula must be Workforce Management Utility type, no legislation and start date 1-1-01.

Step 15: Now to send the time as time for time to absence management we setup an Global Absence Accrual Matrix fast formula as follows.

FORMULA TYPE: Global Absence Accrual Matrix
DESCRIPTION:  This formula calculates the accrual rate
Change History:
Name                Date           Comments 
Pam Koertshuis      21-JUL-2016    Added overtime

/*=========== DATABASE ITEM DEFAULTS BEGIN =====================*/ 
DEFAULT for PER_ASG_REL_ORIGINAL_DATE_OF_HIRE is '4712/12/31 00:00:00' (date)
DEFAULT for PER_ASG_REL_DATE_START is '4712/12/31 00:00:00' (date) 
DEFAULT for PER_ASG_REL_ACTUAL_TERMINATION_DATE is '4712/12/31 00:00:00' (date) 
DEFAULT for adjustmentvalues is EMPTY_NUMBER_NUMBER
DEFAULT for adjustmentdates is EMPTY_DATE_NUMBER
DEFAULT for adjustmenttypes is EMPTY_TEXT_NUMBER


/*=========== DATABASE ITEM DEFAULTS ENDS=======================*/ 

v_person_id = get_context(PERSON_ID,0)

Beginning_Of_Calculation_Year = to_date('0101'||to_char(GET_CONTEXT(EFFECTIVE_DATE,'4712/12/31 00:00:00' (date)),'YYYY')
  End_Of_Calculation_Year = to_date('3112'||to_char(GET_CONTEXT(EFFECTIVE_DATE,'4712/12/31 00:00:00' (date)),'YYYY')
start_date = Beginning_Of_Calculation_Year
stop_date = End_Of_Calculation_Year


accrual = 0
x_tot = 0

x_tot0 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 0', 'APPROVED', 0)
x_tot25 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 25', 'APPROVED', 0)
x_tot50 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 50', 'APPROVED', 0)
x_tot75 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 75', 'APPROVED', 0)
x_tot100 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 100', 'APPROVED', 0)
x_tot120 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 120', 'APPROVED', 0)
x_tot125 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 125', 'APPROVED', 0)
x_tot140 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 140', 'APPROVED', 0)
x_tot150 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 150', 'APPROVED', 0)
x_tot200 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 200', 'APPROVED', 0)
x_tot220 = GET_CALCULATED_HOURS(v_person_id, 'Y', start_date, stop_date, 'Overtime 220', 'APPROVED', 0)

x_tot = x_tot0 * 1 +
        x_tot25 * 1.25 +
x_tot50 * 1.5 +
        x_tot75 * 1.75 +
        x_tot100 * 2 +
        x_tot120 * 2.2 +
        x_tot125 * 2.25 +
        x_tot140 * 2.4 + 
        x_tot150 * 2.5 +
        x_tot200 * 3 + 
        x_tot220 * 3.2

ceiling = 0

accrual = x_tot

/*================ FORMULA SECTION END =========================*/ 


This formula needs to be attached to a vacation plan you relate to the user. Now the total calculated hours are shown on that plan.

woensdag 1 juni 2016

Call Webservice with Proxy from ADF

Following the example from the UI Accelerator app to call a web service in my fusion cloud environment (http://www.oracle.com/technetwork/indexes/samplecode/cloud-samples-2203466.html) I will build the call to the findSelfUserDetails service in ERP Cloud, which I want to use to verify the user.
With many thanks to Hakan Biroglu, for figuring this stuff out in his spare time :-)!

This services does not receive any parameters (like the opportunity examples), so it should be a lot simpler. All we want to do is verify the user information. Like all tutorials it describes the solution bottom up (since you have to develop it bottom up), but it's easier to understand top down. So I'll first try to explain what end result we are trying to achieve and how to get there.

Eventually we want to create a simply page displaying the user information.

This page actually points to a task flow and the task flow contains a page fragment.

The data control however is based on our web service proxy. To be able to call a web service and show it on the page, we will create a web service with proxy project. This will generate a java class that actually calls the web service (which we will overwrite). But next to that we will need two custom java classes to create a view object based on our web service and a java class that fetches the web service results and puts it in the view object.
The view object in its turn will be exposed as a datacontrol and it's that data control that is displayed on our page fragment.

So these are the components we are going to create.

Step 1: Web service with Proxy project

The first step is to create a new project with web service with proxy client. You can create a new application or a project in an existing application.
In your project choose New, Web Services, Web Service Client and Proxy.

As WSDL you refer to your fusion environment (HCM) and make sure you check Copy WSDL into project so you can review the XSD files in your project as well.

In our case we use our own fusion ERP environment, but this can also be sales cloud. It will be something like oraclecloud.com:nnnn, where nnnn is the port number.
On the next page uncheck Generate as Async.

Move on till you get to this page and check Don't generate any asynchronous methods.

On the policy settings uncheck the Show only the compatible client policies. Make sure the port is set correctly and use wss-username-token-client-policy.
And on the next page with the handlers choose the correct port.

Now you can generate the project. This will create a lot of java classes and the definition files.
To give you an idea open the UserDetails.xsd under apps/hcm/people/roles/userdetailsservicev2.

Here you can see the result is UserDetailsResult with a value containing the fields that it will return.
You can verify the return in SoapUI first of course so you have an idea of the structure. As you can see it contains a Value and UserPersonDetails within the value component.

Step 2: Complete Web Service Proxy Java Class

By creating the web service proxy, the system also generates a java class to call our web service. We are not going to overwrite that, since it gets overwritten when the proxy is regenerated. You will find this file under apps/hcm/people/roles/userdetailsservicev2 in UserDetailsServiceSoapHttpPortClient.java.

So the first thing we will do is create our own PortClient.

Choose New, Java Class.

This will generate the following code.

package wsproxysample.custom;

public class UserDetailsServicePortClientCustom {
    public UserDetailsServicePortClientCustom() {

Now we will change this code as follows.

package wsproxysample.custom;

import com.oracle.xmlns.apps.hcm.people.roles.userdetailsservicev2.UserDetails;
import com.oracle.xmlns.apps.hcm.people.roles.userdetailsservicev2.UserDetailsResult;
import com.oracle.xmlns.apps.hcm.people.roles.userdetailsservicev2.UserDetailsService;
import com.oracle.xmlns.apps.hcm.people.roles.userdetailsservicev2.UserDetailsService_Service;

import com.sun.xml.ws.developer.WSBindingProvider;

import java.util.List;
import java.util.Map;

import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;

import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;

// Here our class starts

public class UserDetailsServicePortClientCustom {
// Copy the web service reference annotation with the associated properties (will import or use Alt-Enter). And create two private variables to hold the web service.

    private static UserDetailsService_Service userDetailsService_Service;
    private UserDetailsService userDetailsService;
    public UserDetailsServicePortClientCustom() {
//Next step is to create a list of the user details. The type UserDetails is what we saw earlier in our XSD.
    public List<UserDetails> findUserDetails() throws Exception {
    /* Initialize/authenticate service */

//Initialize the service and set the policy.
    UserDetailsService_Service userDetailsService_Service = new UserDetailsService_Service();
    //we are using basic authorizat ion to call a webservice usin g https protocol, so that we have to use ssl_client_policy OWSMpolicy
    SecurityPolicyFeature[] m_securityFeature =
    new SecurityPolicyFeature[] { new SecurityPolicyFeature("oracle/wss_username_token_over_ssl_client_policy") };
    //initialize binding object by setting up security policy
    userDetailsService = userDetailsService_Service.getUserDetailsServiceSoapHttpPort(m_securityFeature);
    //OpportunityService opportunityService = opportunityService_Service.getOpportunityServiceSoapHttpPort(m_securityFeature);
    //retrieve request context object to setup http header
    WSBindingProvider wsbp = (WSBindingProvider)userDetailsService;
    Map<String, Object> requestContext = wsbp.getRequestContext();

//Here you add the actual service endpoint and the username/password you use to connect.

    String serviceEndpoint = "https://{your fusion cloud environment}/hcmPeopleRolesV2/UserDetailsService";
    String serviceUsername = "{your username}";
    String servicePassword = "{your password}";
    requestContext.put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY,serviceEndpoint );
    requestContext.put (WSBindingProvider.USERNAME_PROPERTY,serviceUsername);    
    requestContext.put (WSBindingProvider.PASSWORD_PROPERTY,servicePassword);
    /* busines logic */

//Again check the XSD to see it returns a userdetailsresult object and a value within that. So we use getValue to get the actual result.

    UserDetailsResult userDetailsResult = userDetailsService.findSelfUserDetails();

        return userDetailsResult.getValue();

So what we've build now is a java program that calls the web service and fetches the results and returns that. Next step is we want to call this service from another java class that puts the result in a view object. Both the view object and the java class to call the service and put the result in the view object is what we will create next.

Note that our example is very simple without any parameters. The opportunity service example is much more elaborate.

Step 3: Create View Object Java Class

Next step is to create a java class for a view object. Go to your View Controller project and choose New, Java Class.

We call this class UserDetailsVO, since it's the view object for our user details. Since this is a custom view object we need to create our own setters and getters for each element we want to display. We will refer of course to the elements in the UserDetails object we've seen in the XSD.

package test.proxysample.view;

import java.io.Serializable;

public class UserDetailsVO implements Serializable {
    private static final long serialVersionUID = 1771059748298259803L;
    private String personNumber;
    private String displayName;
    private String firstName;
    private String emailAddress;
    public UserDetailsVO() {
    public void setPersonNumber(String personNumber) {
    this.personNumber = personNumber;
    public String getPersonNumber() {
    return personNumber;

    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public String getFirstName() {
    return firstName;

    public void setEmailAddress(String emailAddress) {
    this.lastName = emailAddress;
    public String getEmailAddress() {
    return emailAddress;

    public void setDisplayName(String displayName) {
    this.displayName = displayName;
    public String getDisplayName() {
    return displayName;

So now we can display first name, last name, display name and the person number. If we want to display more values, we need to add them here.
Next step is to call the web service and fill our view object with data.

Step 4: Create Java Class to call Webservice and fill View Object

We create another java class in our View Controller project called UserDetailsBean.

The code for this bean is as follows. Note that the structure of our result (Value and PersonDetails) is flattened in our view object.

import com.oracle.xmlns.apps.hcm.people.roles.userdetailsservicev2.UserDetails;
import com.oracle.xmlns.apps.hcm.people.roles.userdetailsservicev2.UserPersonDetails;

import java.util.ArrayList;
import java.util.List;

import test.proxySample.model.custom.UserDetailsServicePortClientCustom;

public class UserDetailsBean {
    private UserDetailsServicePortClientCustom proxyClient;
    public UserDetailsBean() {
        this.proxyClient = new UserDetailsServicePortClientCustom();
// We create a new list for our UserDetails View Object.

    public List<UserDetailsVO> findUserDetails() throws Exception {

// This list is initialized by calling our finduserDetails web service.
    List<UserDetails> list = proxyClient.findUserDetails();
    List<UserDetailsVO> response = new ArrayList<UserDetailsVO>();

// And now we want to parse the result of our web service back to our view object. The top level of our service was the Value. So we loop through the header UserDetails and fetch all the values from the UserDetails object.

    for (UserDetails udBind : list ) {
    //The following at t ributes are returned in the xml payload
    String personNumber = udBind.getPersonNumber().toString();

// Create a new view object instance.
    UserDetailsVO udVO = new UserDetailsVO();

// And set the person number field.

// Then we get the Person Details, which is a sub of the person. This contains the first name, last name and display name. Review your Soap UI project if you are not sure of the level.

    List<UserPersonDetails> userPersonDetails = udBind.getUserPersonDetails();

// Loop through the results of the details and put the fields in the VO.

    for (UserPersonDetails upd : userPersonDetails) {

        String displayName = upd.getDisplayName().getValue().toString(); 
        String emailAddress  = upd.getEmailAddress().getValue().toString();
        String firstName = upd.getFirstName().getValue().toString();


// Return response
    return response;

Step 5: Expose bean as data control

This is simple, right click on the UserDetailsBean and choose Create Data Control at the bottom.

The bean is now exposed as data control and you can drag it onto a page. So we will now create a simple task flow with a page fragment and drag the data control to the page fragment.

Step 6: Create task flow and page fragment

On your View Controller project choose New, ADF Task Flow.

Choose New on your View Controller, ADF Page Fragment. You can base it on a template or for now we simply create a blank page.

Drag the CallWS.jsff onto your task flow callWS-flow.
You can also add page parameters to the task flow, but we won't do that for now.

Now we drag the data control onto our callWS.jsff page fragment.

Our very simple page now looks like this

Step 7: Create task flow and page fragment

The last step is to create our main page and drag the task flow onto that page. To do this create a new page. Add a PanelGroupLayout with vertical alignment. Drag the task flow in the source editor in the group layout and make sure you move it in the group layout.

Step 8: Import certificates

Before you deploy it, we first have to import the certificates from the service.

Go the website of your fusion application in Internet Explorer or Firefox and click on the lock.  Choose Export to export the certificates.

On the mac find the location of your JDK (keytool). In my case it was located in 

Second, save the certificates in some directory on your computer. Let's say this is /users/../myDir
Check the location of the keystone in your Jdeveloper, Preferences. Let's say this is {KeyStorePath}.

keytool -importcert -file /users/../myDir/eccs-test-root.cer -keystore {KeyStorePath} -alias eccs-test-root -storepass DemoTrustKeyStorePassPhrase
keytool -importcert -file /users/../myDir/eccs-test-intermed.cer -keystore {KeyStorePath} -alias eccs-test-intermed -storepass DemoTrustKeyStorePassPhrase
keytool -importcert -file /users/../myDir/eccs-test-fs.em2.oracle.com.cer -keystore {KeyStorePath} -alias eccs-test-fs.em2.oracle.com -storepass DemoTrustKeyStorePassPhrase

Step 9: Set web logic security

Go the project properties of your view controller project.

Choose Run/Debug and edit the Default configuration.
in the java options of the virtual machine.

Step 10: Run on integrated web logic server

Click on the home page and choose Run.


So if you want to add more fields to display in your web service data control, modify UserDetailsVO.java.
You can also add information from the user session details or user work relationship details for example. For example fetch the language from the user session details. Add this field to your view object.

    private String language;

    public void setLanguage(String language) {
    this.language = language;
    public String getLanguage() {
    return language;

Then add it to the UserDetailsBean.java, since we need to fetch it from the web service and put it in the data control.

Add this to the UserDetailsBean.java after the for loop for the person details.

        List<UserSessionDetails> userSessionDetails = udBind.getUserSessionDetails();
        for (UserSessionDetails usd : userSessionDetails) {
            String language = usd.getLanguage().getValue().toString();             

Now go to your page fragment (callWS.jsff) and drag the language on the page. Set the property Behavior Read Only to true.

And when you re-run your page ...

Have fun!