Hi Developers,
I decided to write this blog after googling a lot and finding nothing concrete for sample Hello world implementation for Oracle MAF(Mobile Application Framework) using Web services.
The sample is divided in two half:
1. Create Web Service using Oracle ADF fusion web application.
2. Create an Oracle MAF project to incorporate the web service and create app for the same.
1. Create Web Service using Oracle ADF fusion web application:
It is not necessary to use Oracle ADF for developing the web service, you can use Oracle SOA, java web service or any web service development platform on this planet. Ultimately what we need is a WSDL(Google w3c schools for more information on WSDL).
Lets get started :
Step 1 : Create a Oracle ADF Fusion Web Application.
Step 2 : Name : HelloWorldService
Step 3 : Click Finish to complete a wizard
After step 3 you can see following structure in you Jdeveloper :
Step 4 : Right Click Model->New->From Gallery, in search window type JAVA and from the list select JAVA Class:
Step 5 : Create a JAVA file with name : HelloWorld.java(keep rest all default and complete the wizard), add following code to the file :
-----------------------------
public String sayHello(String input) {
return "Hello "+ input;
}
----------------------------
Your code should look similar to following :
Step 6 : Right click the HelloWorld.java and select Create Web Service option. Select following option click Next and Finish.
Step 7 : Once the wizard is complete you can see the changed code as shown below :
Step 8 : Right Click the HelloWorld.java and click Test web service. Web logic server will start,once the server is up and web service is ready you will see the following :
Test your web service and if you get correct output(as shown below) our first job is done :
2. Create an Oracle MAF project to incorporate the web service and create app for the same:
Step 1 : Create a new project and Select Mobile Application Framework Application,click Ok.Follow the screen shot below to create the application :
keep rest things default and finish the wizard.
Step 2 : Open the maf-feature.xml file :
Step 3 : Select the feature Hello, go to content tab, click Plus(+) symbol and select AMX page, create the page with name HelloClient.amx.
Step 4 : Open the HelloClient.amx:
Step 5 : Right click View Controller, Select New->From Galary-> Search Web service -> select Web Service Data Control(SOAP/REST)(Data Controls).
Following wizard will open :
Step 6 : Copy the web service created in first section( make sure to have IP address and not host name) , Name the data source as Hello_WL and paste the WSDL in URL field as shown below :
Step 7 : Drag Process into Left side and click Finish :
Step 8 : After completion of wizard your data control should look as shown below :
Step 9 : Select sayHello(String) and drag it on to the page. Once you drop it Jdeveloper ask you for number of options. Select Method->MAF Button :
Step 10 : Keep arg0 as blank and click Ok:
Step 11 : Make sure following figure matches with your code :
We have just created a command button which will call the web service.
Step 12 : Now drag String on to the page and select details as shown below :
In this step we created an Input box which accepts the value such as "Nakul" or "Peter" etc. That is it all development done.
Step 13 : Complete the deployment :
Let us check output now : click HelloWorldClientMAF
Set value in Input value field and click submit, if you get response as shown below, yes we have won our first battle.
I decided to write this blog after googling a lot and finding nothing concrete for sample Hello world implementation for Oracle MAF(Mobile Application Framework) using Web services.
The sample is divided in two half:
1. Create Web Service using Oracle ADF fusion web application.
2. Create an Oracle MAF project to incorporate the web service and create app for the same.
1. Create Web Service using Oracle ADF fusion web application:
It is not necessary to use Oracle ADF for developing the web service, you can use Oracle SOA, java web service or any web service development platform on this planet. Ultimately what we need is a WSDL(Google w3c schools for more information on WSDL).
Lets get started :
Step 1 : Create a Oracle ADF Fusion Web Application.
Step 2 : Name : HelloWorldService
Step 3 : Click Finish to complete a wizard
After step 3 you can see following structure in you Jdeveloper :
Step 5 : Create a JAVA file with name : HelloWorld.java(keep rest all default and complete the wizard), add following code to the file :
-----------------------------
public String sayHello(String input) {
return "Hello "+ input;
}
----------------------------
Your code should look similar to following :
Step 6 : Right click the HelloWorld.java and select Create Web Service option. Select following option click Next and Finish.
Step 7 : Once the wizard is complete you can see the changed code as shown below :
Step 8 : Right Click the HelloWorld.java and click Test web service. Web logic server will start,once the server is up and web service is ready you will see the following :
Test your web service and if you get correct output(as shown below) our first job is done :
2. Create an Oracle MAF project to incorporate the web service and create app for the same:
Step 1 : Create a new project and Select Mobile Application Framework Application,click Ok.Follow the screen shot below to create the application :
keep rest things default and finish the wizard.
Step 2 : Open the maf-feature.xml file :
Step 3 : Select the feature Hello, go to content tab, click Plus(+) symbol and select AMX page, create the page with name HelloClient.amx.
Step 5 : Right click View Controller, Select New->From Galary-> Search Web service -> select Web Service Data Control(SOAP/REST)(Data Controls).
Following wizard will open :
Step 6 : Copy the web service created in first section( make sure to have IP address and not host name) , Name the data source as Hello_WL and paste the WSDL in URL field as shown below :
Step 7 : Drag Process into Left side and click Finish :
Step 8 : After completion of wizard your data control should look as shown below :
Step 9 : Select sayHello(String) and drag it on to the page. Once you drop it Jdeveloper ask you for number of options. Select Method->MAF Button :
Step 10 : Keep arg0 as blank and click Ok:
Step 11 : Make sure following figure matches with your code :
We have just created a command button which will call the web service.
In this step we created an Input box which accepts the value such as "Nakul" or "Peter" etc. That is it all development done.
Step 13 : Complete the deployment :
Let us check output now : click HelloWorldClientMAF
Set value in Input value field and click submit, if you get response as shown below, yes we have won our first battle.




