Follow by Email

Tuesday, 22 December 2015

Create SOAP Web Service with Application Module quickly in ADF 12.2.1


SOAP stands for Simple Object Access Protocol, a protocol to exchange information in XML format between two applications over HTTP. This protocol is used to create ,access and consume web services.

SOA (Service Oriented Architecture) focuses on re-usability and exposing application module as web service makes it's methods and objects accessible from any device , any platform and these methods and objects can be further used by any other application

In ADF 12.2.1 we can create a SOAP web service within seconds , See how to configure Application Module to expose it's methods and objects to service interface
  • Created a Fusion Web Application using Departments and Employees table of HR Schema


  • Open Application Module and Web Service tab, there is a separate tab for SOAP , click on green plus icon



  • In Step 1 we can set Web Service Name and Target Namespace, Also enable option to generate asynchronous methods, by default it supports synchronous service methods .
    Read in detail check this - Creating SOAP Web Services with Application Modules


  • In Step 2 we can expose some built in methods and in Step 3 if we have any custom methods defined in Application Module then we can expose these methods to service interface.
    Here i have created a simple method in AMImpl to get department name from it's id and exposed this method in service




  •     /**Method to get Department Name from Department Id
         * @param deptId
         * @return
         */
        public String getDeptName(Integer deptId) {
            String deptName = "Department not found";
            ViewObject deptVo = this.getDepartments1();
            Row[] filteredRows = deptVo.getFilteredRows("DepartmentId", deptId);
            if (filteredRows.length > 0) {
                deptName = filteredRows[0].getAttribute("DepartmentName").toString();
            }
            return deptName;
        }
    



  • In Step 4 select viewObject that we want to expose and their methods , i have selected both Departments and Employees viewObject and enabled operation for both
    For Departments ViewObject -

  •  For Employee ViewObject-


  • Click on Finish to create service interface and all required files 


  • Now to run and check web service , Expand Application Module root and there is a  service implementation java class SoapWebServServiceImpl.java  , Right click on this and choose Run


  • On running you'll see an URL in weblogic log tab, click on that url it will open HTTP Analyzer tool and there you'll see list of all operation , here i have selected GetByKey operation of Departments viewObject

  •           Here i passed depatmentId as key parameter and you can see web service response

  • Again i selected create operation for Departments viewObject and provided all parameters and click Send Request button


  •                   and result in database table


  • This time i am checking custom method defined in application module to get Department Name



All Done :) Sample ADF Application-Download

Cheers :) Happy Learning

5 comments :

  1. Very nice simple and post to follow. Thanks a lot :)

    ReplyDelete
  2. Hi Ashish,

    Thank you very much for giving this

    ReplyDelete
  3. Hi Ashish,

    How can I set timeout for the generated wsdl operations. Currently my requests are getting timed out after 60 seconds. Please help.

    ReplyDelete
  4. can we create SOAP web service with AM in ADF 12.1.3?

    ReplyDelete
    Replies
    1. Yes you can create, Just follow same steps

      Delete