Saturday 23 November 2013

Exposing Web Services Using the ADF Model Layer


This blog we will see how to create a web service in ADF Model layer.

The following steps need to follow for creating a web service.

Step-1:- Create a Fusion Web Application (ADF).

Step-2:- Create a database connection.
 

Step-3:- Right click on the Project -- >Select ADF Business Components -- >Click on Business Components from Tables.

Step-4:- Create an entity object (For which table you want to create service).

Step-5:- Create view object for the same entity object.

Step-6:- Add the view object in application module.
 

Step-7:- Double click Application Module, select Service Interface and click on Add button.

Step-8:- Change the Web Service Name and the Target Namespace value if required. Select the check box “Generate Asynchronous Web Service Methods”.
 

Step-9:- Click Next -- >Next
Step-10:- Move the Available View Instance to the Selected Side and select the operations that need to be exposed via service.

Step-11:- Now the service is created. You can right click on Implementation class and run the service.

Step-12:- After running the Implementation class it will give the service URL.
Step-13:- Now you can test your service in HTTP Analyzer. You can click the URL.


Step-14:- You can enter the input for the service and click the “Send Request”. You will get the output from the service.
 

Step-15:- Now we will see how to create a custom method inside the service. Open the Application Module and click on “Java” tab then add java class.
 
Step-16:- Check the Application Module Implementation class then click “OK”.

Step-17:- Now open Application Module Implementation class and add the custom method.
    

public String getName(String name){
        return "You Entered "+name;
    }
 

Step-18:- Add the custom method in client interface.
Step-19:- Now open the Service Interface and click on the “Service Interface Custom method” and add the custom method in selected side.
Step-20:- Now you can run Service implementation class and test the service.

You can download the code:Download

Thanks...


No comments:

Post a Comment