Please disable your adblock and script blockers to view this page

Search this blog

Saturday 3 June 2017

Access JAX-WS WebService from Java Class using Web Service Proxy in Jdeveloper

Web Service proxy class is a way to communicate with XML-based WebService using SOAP format,
In short, we can use service proxy class at client to access WebService

In JDeveloper IDE we can easily create client proxy class for WebService, Here in this post I am creating client proxy class to access a JAX-WS web service that I have created in previous blog post

Create POJO based JAX-WS WebService easily with Jdeveloper 12.1.3

Let's see how to implement this

  • Create a new Custom Application in Jdeveloper IDE, Go to File -- New -- Application

  • Put name and package for application

  • Click on Finish to create application

  • Right-click on the project and select from gallery Business Tier -- Web Services -- Web Service Client and Proxy. See the description it tells that client proxy is used to make a call to remote web service 

  • Enter Web Service URL and click on next 

  • Click on Finish to create WS client proxy class 

  • Now you can see all classes and configuration files are created by IDE itself

  • Now open EmployeesPortClient class and It looks like this, Accesses Employees Web Service

  • Here I am adding code to iterate over Employees list returned from Web Service

  • import java.util.ArrayList;
    // This source file is generated by Oracle tools.
    // Contents may be subject to change.
    // For reporting problems, use the following:
    // Generated by Oracle JDeveloper 12c
    public class EmployeesPortClient {
        public static void main(String[] args) {
            EmployeesService employeesService = new EmployeesService();
            Employees employees = employeesService.getEmployeesPort();
            // Add your code to call the desired methods.
            ArrayList<EmpBean> emp = (ArrayList) employees.getEmpList();
            for (EmpBean empl : emp) {
                System.out.println("Name- " + empl.getName());

    Here getEmpList is the method of Web Service that returns list of Employees
    and output is
Sample ADF Application-Download
Cheers :) Happy Learning

No comments :

Post a Comment