Sunday, April 12, 2015

ADF BC Web Service - Return List of Complex Types

ADF Business Components can be exposed as SOAP Services. Application Module provides Service Interfaces as a way to define operations for the services to be exposed. Custom methods written in AMImpl class can also be exposed as operation of web services.

But one of the limitation is that there is restriction on return types from the services exposed as service interface from Application Module.

In this post we will see how easily we can develop a web service using ADF BC Service Interface and can tweak/use one of the given returnType List<ViewRowImpl>  to return list of complex type object.

Use case here is to create an operation in ApplicationModuleImpl class to return List of Object consiting of three variables -  DepartmentName,ManagerId,IsManagerFlag and expose the operation as ADF BC Service Interface SOAP Service. (Jdeveloper 11.1.1.7)


So Lets get started

Created a simple ADF Web Application using HR Schema and created DepartmentsEO , VO and AM and there respective Java Classes.

Create a Programmatic VO - WSResultPVO which will be returned from the operation of the WebService.





Now Add three variables in the PVO. DepartmentName,ManagerId and IsManagerFlag. 



Generate Necessary VOImpl and RowImp classes and set datatypes for the variables.

Remember to make these variables set AlwaysUpdatable as below.




Do a next and finish.

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 clear from the code, the rows of WSResultPVO is being set programmatically. DepartmentsVO is iterated and value of DepartmentName and ManagerId is fetched and set into the rows of WSResultPVO. IsManagerFlag is being set Y here which can be changed based on any logic in real time use cases. 

At last the WSResultPVO row is added to the List - returnList which is being returned by the operation method.

We are all done with code part. Now lets quickly create service interface and expose the web service.

Go to Service Interface tab of AM. Click on Green Add Icon.


Here you can define the service name. We will go with default for this example.



On Next screen just shuttle the method which we need to expose and which is there in AMImpl class.



We need to define what will be the return type from the operation. So expand the shuttled method and click java.util.List and select WSResultPVO from below as shown below.




Do next and finish. Below will be added to Service Interface.




Thats it we are done now. Just Run the newly generated serviceImpl class from serviceInterface.


After running, there will be link of the exposed service and one can test it. Just click the operation and below shown will be the results.




So by using ViewRowImpl, we can return List of complex type object which can carter requirement of having complex type returned from the service.

Thanks






19 comments:

  1. Good to know that! Do you know if its possible to work with this List in Oracle MAF? I have a requirement to create a Web Service to return a complex list and show on my Mobile Application.
    Thank you.

    ReplyDelete
  2. Thanks Rohan.
    It is a very useful for exposing complex type (Return type )webservice !!!!
    waiting for more useful POC's

    ReplyDelete
  3. Replies
    1. An important building block of SEO is to develop your website which can be easily understandable for both Online Visitors (most important) and search engine robots. In the current digital age, seo is important for your online success means to generate leads.

      SEO Services in IndiaSEO Company in India SEO Company in India SEO Services in India

      SEO Company in India SEO Services in India

      Delete
  4. A very good and informative article indeed. It helps me a lot to enhance my knowledge. Keep sharing in future.I will be waiting for your next blog.
    latest technologies in computer

    ReplyDelete
  5. Hi Rohan,
    Thanks for nice blog.
    I have a scenario where I want to return Master-Detail data as Complex Return Type.
    Can you help me on this on How to achive this?

    Regards,
    Kaustubh Patel.

    ReplyDelete
  6. This article provide excellent information. I really like it and understand many things from here this page, Professional web app developer USA

    ReplyDelete
  7. This blog is so nice to me. I will keep on here again and again. Visit my link as well..
    SEO services pakistan

    ReplyDelete
  8. Hello, I tried but I get the following error, I use ADF 10.3g
    serialization error: no serializer is registered for(class xxx.xxx.xxx,null) serialization error:

    ReplyDelete
  9. "Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.php jobs in hyderabad.
    "

    ReplyDelete
  10. If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you gotta watch this video
    right away...

    (VIDEO) Have your ex CRAWLING back to you...?

    ReplyDelete
  11. Great blog you have written for us Thanks for sharing good content keep sharing... check it once through MSBI Online Training for more information on microsoft.

    ReplyDelete
  12. hi
    what type of deployment(eg JAR ,SAR,WAR) could i deploy for this application, so i can reuse this web service in other applications

    ReplyDelete
  13. • Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online Training HYDERABAD

    ReplyDelete
  14. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking
    Internet Marketing Companies Bangalore
    Digital Marketing Company Bangalore
    Best SEO Services in Bangalore

    ReplyDelete