X

Shay Shmeltzer's Oracle Development Tools Tips

Developing with Oracle MAF and Oracle ADF Business Components - The REST Edition

Shay Shmeltzer
Director of Product Management - Oracle

When Oracle ADF Mobile was released over 3 years ago, one of the first blogs I created on this topic showed how to leverage Oracle ADF Business Components to access a server database and create a mobile front end on top of it.

Since then both frameworks have matured, and we learned some best practices doing implementations internally and for customers. Today I'm going to show you a better way to build this type of applications, specifically leveraging REST as the communication protocol between the ADF backend and the Oracle MAF front end. REST based integration performs much better than SOAP for this mobile scenario, and as you'll see development is as simple.

Specifically I'm leveraging the Oracle A-Team Mobile Persistence Accelerator (AMPA) JDeveloper Extension- this extension simplifies MAF's interacting with REST backends, and has some cool extra features if your  REST services are based on ADF BC.

I used JDeveloper 12.2.1 to expose REST services from my ADF Business Components.  If you are not familiar with how to do that, see this blog on exposing ADF BC as REST services, and then this blog about enabling CORS for ADF Business Components.

The video below picks up the same application (Application14) and continues from where the previous two ended. 

Now let's see the MAF development part:

As you can see, it is quite easy to create your MAF UI. The AMPA extension does a lot of work for you making the access to the REST backend as easy as possible. (thanks goes out to Steven Davelaar).

The AMPA extension can also generate a complete UI for you - so you can give that wizard a try to if you are  looking for even more productivity. 

Join the discussion

Comments ( 10 )
  • guest Wednesday, January 27, 2016

    I deployed a REST WS in JDev 12.2.1 and used JDev 12.1.3 to invoke it using the steps described in the video. However, I get the follwoing error:

    Cannot access URL http://127.0.0.1:7101/WebServices/rest/1/dept/describe: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map. Check the JDeveloper Http Proxy Server settings under Tools -> Preferences.

    Am I doing something wrong?


  • guest Wednesday, January 27, 2016

    guest - can the URL be invoked properly from a web browser?

    Where do you get the error? Is it in the AMPA wizard? did you check your JDeveloper's proxy settings?

    Post your question with more details on the MAF forum on OTN:

    https://community.oracle.com/community/oracle-mobile/oraclemaf


  • guest Friday, March 4, 2016

    Hello Shay,

    I developed services with Jdev 12.2.1 with REST support for ADF BC. If want to consume those with MAF Application the only way to create a Data Control is through AMPA extension?


  • Shay Shmeltzer Friday, March 4, 2016

    guest - AMPA just makes it easier by creating the code for you through wizards.

    If you prefer you can also manually code the call to ADF BC REST services from MAF - the same way you would code any REST call from MAF.


  • guest Monday, March 7, 2016

    Shay,

    MAF has a declarative way to create a SOAP Data Control. Is there anything like that to crrate a REST Data Control?

    Thank you


  • Shay Shmeltzer Monday, March 7, 2016

    guest - the AMPA extension shown in the video is the declarative way. We are working on incorporating this type of wizard into the shipped MAF extension.


  • guest Sunday, June 26, 2016

    Hi Shay,

    After using the new shipped MAF 2.3.1 with the AMPA extension

    Using it with ADFBC Rest enabled web service gives error regarding the

    ADF content type not supported

    Please advise


  • Mahmoud Gabr Wednesday, July 6, 2016

    Hi shay .

    I discovered the above problem reason in dealing with ADFBC

    I must use the /describe in the URL , and changing

    Any of the provided default values in the remaining of the wizard gives the above type not supported

    Error.

    I was changing the batch method to post with the URL /Department instead

    Of the default /Department/{id}

    But this may be a little bit confusing , how we are updating an object with only the ID as

    A path parameter provided not the whole object

    Please advise


  • guest Thursday, October 13, 2016

    I have followed this example, with slight variations: I am using MAF extension 2.3.1, so have AMPA built in. Must say, impressed with AMPA. I deployed to Android emulator and it works fine (though I had to change the IP in connections.xml from 127.0.0.1 to 10.0.2.2 - as described in: http://stackoverflow.com/questions/17811172/connection-error-connection-refused).

    When I deploy locally to Windows UWP, the app works but cannot connect to the REST service. Tried with IP=127.0.0.1 and 10.0.2.2. Various errors:

    Error invoking REST GET service...Connection timed out... (127.0.0.1)

    Error invoking REST GET service...No route to host... (10.0.2.2)

    Also tried with the Microsoft Loopback Network adapter installed, but no success.

    Is there any specific guidance on deploying MAF app with REST to Windows/UWP?

    Thanks, in anticipation.


  • Shay Shmeltzer Thursday, October 13, 2016

    guest - the first thing to check is whether you can access the REST service from the mobile device's browser using the URL you provided - to verify if it might be an ip recognition issue. If you still run into issues try posting on the MAF discussion forum on OTN - https://community.oracle.com/community/oracle-mobile/oraclemaf


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.