Monday, November 26, 2012

Mobile ADF: Webservice Call Using Oracle ADF Mobile Framework (Android)


Web-service Call Using Oracle ADF Mobile Framework (Android)

Writing web service 

I have written a simple webservice which will take String as parameter and return result in the form of String itself.


package samplewebservice; 

import javax.jws.WebMethod; 
import javax.jws.WebParam; 
import javax.jws.WebService; 

@WebService 
public class SampleService { 

    public SampleService() { 
     super(); 
    } 

    @WebMethod 
    public String sayHello(@WebParam(name="name") String name){
      return "Hello, "+name+" !!!!!!!!!!!!!!!!!!!"; 
    } 
 } 


Deploying Web-service 

Once service developed you have to deploy that service on some server. I am using weblogic server to deploy HelloService(You can select any server). Start your server.


  • Select Application as Mobile Application(ADF) template
  • Provide application name like WebServiceCall 
  • Click on finished. it will create 2 project in application ApplicationController and ViewController
  • Select ApplicationController and created webservice datacontrol.
  • Provide WSDL with your system IP address because localhost and 127.0.0.1 doen't work for mobile. 
  • Enter webservice url and datacontrol name
  • Click on next then select method and click on finished.
  • Now Select the ViewController Project and Right Click and go on new.
  • Select ADF mobile from the Client Tire from category
  • Provide the feature name like WebserviceCall and click on Ok button. It will created a folder with name of WebServiceCall inside public_html.
  • An Entry with the feature name will added to adfm-feature.xml file
  • Select the feature id from feature table
  • Go to content tab
  • Click on the + icon of file
  • Select the taskflow it will ask you to enter name for task flow enter name and same taskflow will created.
  • Now select the WebserviceCall feature folder and create amx page with name of LoginPage.amx
  • Drag and drop that amx to taskflow as default activity
  • Create responsePage.amx for showing service response
  • Define the ControlFlow as ShowResult
  • Expand created data control
  • Drag and drop name from parameter to amx page as inputtext.
  • Provide label as Enter your name
  • Surround it with panelFormLayout 
  • Drag Drop sayHello method as button screen
  • Open responsePage.amx and dragdrop String as outputtext with label.

Deploying Application to Android simulator

  •  Select the Application
  •  Goto properties and define deployment profile
  • Start your AVD

  Please follow my previous post to setup AVD click here

Running Application

  • Open Application 


  • Enter your name



Note : Replace the IP in the downloaded files with your machine IP address



3 comments:

  1. Hi Amit. I am new in ADf mobile so I am facing some issue to check my application on mobile with task flow but my help page is working fine. On my Android emulate when I check my deployed application first time, I see some issue like getport () kind of error on my page and I am not able to see my first page

    ReplyDelete
  2. Can u post any tutorial on how to call web service programatically , Reply me or mail me if already posted such tutorial

    ReplyDelete
  3. Can u post any tutorial on how to call web service programatically , Reply me or mail me if already posted such tutorial

    ReplyDelete

Thanks for your valuable comment. You comment will go live soon.