ADF Mobile and SDO: getting results

In my previous post, I explained how to make web service calls to SDO view objects exposed through a service-enabled application module. So far, so good. What I didn't explain is how you can access the return value of the service call if there is one. The answer is straightforward... once you figured it out.

 Our starting point, once again, is JDeveloper's Data Control palette.

As you can see,  the name of the return value is result. Consequently, one could be tempted to use GenericTypeBeanSerializationHelper to convert the value. And one would be right. Even better: you don't have to worry about the type name exposed by the data control as with input parameters. Here, I simply retrieve the results of the call in VisitResultBO, which is a simple POJO. 

GenericType genericReturnValue =
    (GenericType)AdfmfJavaUtilities.invokeDataControlMethod("VisitsWS", null, "getVisit", 
                                                            namesList, paramsList, 
                                                            typesList);
Object returnValue =
    GenericTypeBeanSerializationHelper.fromGenericType(VisitResultBO.class, 
                                                       genericReturnValue,
                                                       "visit");

What makes it not obvious is that the fromGenericType method has got two signatures: 

fromGenericType(java.lang.Class beanClass, GenericType gt)
fromGenericType(java.lang.Class beanClass, GenericType gt, java.lang.String attributeName)

For SDO web services, you absolutely need to use the second form and pass "result" as the value for attributeName. I must admit it took me some time to realize this. 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Frédéric Desbiens

The musings of a member of the ADF Product Management team.

I focus here on my favorite development framework but also have a strong interest in Mobile Development, Oracle WebCenter and Oracle SOA Suite.

Attentive readers will even find posts about IT Strategy from time to time, an interest of mine since I completed my MBA in 2006.

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today