By Blueberry Coder on Apr 19, 2013
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.