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.
Generate Necessary VOImpl and RowImp classes and set datatypes for the variables.
Remember to make these variables set AlwaysUpdatable as below.
On Next screen just shuttle the method which we need to expose and which is there in AMImpl class.
Do next and finish. Below will be added to Service Interface.
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
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.
ReplyDeleteThank you.
Thanks Rohan.
ReplyDeleteIt is a very useful for exposing complex type (Return type )webservice !!!!
waiting for more useful POC's
Very nice explanation, thanks a lot .
ReplyDeletesoftware development company
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.
ReplyDeletelatest technologies in computer
Hi Rohan,
ReplyDeleteThanks 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.
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
DeleteThis article provide excellent information. I really like it and understand many things from here this page, Professional web app developer USA
ReplyDeleteThanks Rohan.Very helpfull.
ReplyDeleteThanks Vamsi !!
ReplyDeleteThis blog is so nice to me. I will keep on here again and again. Visit my link as well..
ReplyDeleteSEO services pakistan
Hello, I tried but I get the following error, I use ADF 10.3g
ReplyDeleteserialization error: no serializer is registered for(class xxx.xxx.xxx,null) serialization error:
"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"
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.
ReplyDeletehi
ReplyDeletewhat type of deployment(eg JAR ,SAR,WAR) could i deploy for this application, so i can reuse this web service in other applications
• 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
ReplyDeleteExcellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking
ReplyDeleteInternet Marketing Companies Bangalore
Digital Marketing Company Bangalore
Best SEO Services in Bangalore
Good article , everybody like this, You are so awesome! I don’t suppose I’ve truly read through a
ReplyDeletesingle thing like this before. So wonderful to find somebody
with some original thoughts on this topic. Seriously.. thank
you for starting this up. This website is one thing that is required on the web, someone with a little originality!
Hi, This is a great article. Loved your efforts on it buddy. Thanks for sharing this with us..
ReplyDeleteMicrosoft Windows Azure Training | Online Course | Certification in chennai | Microsoft Windows Azure Training | Online Course | Certification in bangalore | Microsoft Windows Azure Training | Online Course | Certification in hyderabad | Microsoft Windows Azure Training | Online Course | Certification in pune
Nice information that you have shared with us. It's and interesting blog. Thanks for sharing nice information. Here I also want to share a site London web design and it will be beneficial for others.
ReplyDeleteHi Rohan,
ReplyDeleteIs there any possibility to have a POJO as a return type for this custom action exposed at AM level or Viewobject level?