Friday, March 25, 2016

Returning Complex Data Types from ADF SOAP Web Services!

We already discussed how easy it is to expose ADF Business Components as SOAP Web Services. We have also discussed on how to expose the custom methods on to SOAP Web Services. See blog Quickly Creating, Deploying and Testing SOAP WebServices in ADF for more details. 

This blog is focused to show what data types ADF SOAP Web Services support.
Unlike ADF Client Interface, Service Interface supports a more narrow set of data types for custom method parameters and return values and is limited to:
  • Java primitive types and their object wrapper types (for example int, Integer);
  • java.lang.String;
  • java.math.BigDecimal;
  • java.math.BigInteger;
  • java.sql.Date;
  • java.sql.Time;
  • java.sql.Timestamp;
  • java.util.Date;
  • oracle.jbo.AttributeList;
  • oracle.jbo.domain.BlobDomain;
  • oracle.jbo.domain.Char;
  • oracle.jbo.domain.ClobDomain;
  • oracle.jbo.domain.DBSequence;
  • oracle.jbo.domain.Date;
  • oracle.jbo.domain.NClobDomain;
  • oracle.jbo.domain.Number;
  • oracle.jbo.domain.Timestamp;
  • oracle.jbo.domain.TimestampLTZ;
  • oracle.jbo.domain.TimestampTZ;
  • oracle.jbo.server.ViewRowImpl or any subtype;
  • java.util.List, where aType is any of the service-interface supported data types, including Java primitive type.
NOTE: The service interface specifically does not support Java Map collection. This means it is not possible to return a collection of objects that are of different types. The service interface does not support custom classes as parameters or return types.

Assume the ADF SOAP WS EmployeesService is already available with basic CRUD operations, one simple custom method which returns String type. This was an ADF web application with Employees and Departments tables of HR schema. Having said, let’s look at few examples through which you can return few complex types.

Example to return the list of Department rows:

Code is written like below.

Open EmployeesAM – Service Interface tab – click on pencil icon in Service Interface Custom Methods section.
In Service Custom Methods window, shuttle the new custom methods to right side. Expand the method declaration and ensure to map both Element Java Type and Element View Object as shown below. Once mapped, click OK.


Example to return the list of custom VO rows:

Create a Programmatic VO which will be populated programmatically. 
Now, add three variables in the VO. DepartmentName, ManagerId and IsManager.

Generate Necessary VOImpl and RowImpl classes and set data types for the variables.
Remember to make these variables set AlwaysUpdatable as below.

Keep clicking Next and say Finish. Also, make sure to add this VO instance to EmployeesAM.
Now write a method in AMImpl class which has a code below. This method is an operation of the Web Service which will return the List of Complex type.
As shown earlier, expose this method on to Service Interface.
 
Deploy the EmployeesService as described in my blog Quickly Creating, Deploying and Testing SOAP WebServices in ADF.
Test the first service operation. Chose getDepartmentManagerDetails operation and click Invoke.
It gives the response like below.
Now chose 2nd operation getDeptMgrDetailsWithCustomReturn and click Invoke button. 
It provides the response like below.
So by using ViewRowImpl, we can return List of complex type object which can cater requirement of having complex type returned from the service.


Happy Learning.. :) 

1 comment:

  1. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here.Same as your blog i found another one Oracle Fusion Financials.Actually I was looking for the same information on internet for Oracle Financials Cloud and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.


    ReplyDelete