vrijdag 18 december 2015

Schedule calling webservices in your PAAS for SAAS environment

We came across the issue that we need to fetch data from our SAAS environment (could be Sales Cloud, Financials Cloud, etc) on an ongoing basis to make sure the data in our environment is up to date and for speed we want to fetch the data in a batch at night for example.

Now we were used to schedule a concurrent program in eBS if necessary, but now we have this architecture right ...


So for example Java Cloud Service with included Database Cloud Service. We build a custom application in ADF and deploy that to our JCS.
Now we need some information from the SAAS application and of course we can call a webservice to retrieve the data, but in some cases we like to fetch data in bulk in the night for performance and so we can query a group of objects with batch-integrated information.

We cannot schedule something in the SAAS environment to call webservices (and push the data), so we need some scheduling mechanisme in our PAAS environment to retrieve the data.

Oracle Java Cloud Service itself does not support timers or cron, but the Oracle Database Cloud Service supports a package called CLOUD_SCHEDULER which is able to call a PL./SQL stored procedure service.
The Oracle Database Cloud service also supports the ability to call a REST service on Java Cloud Service. This REST service on the Java Cloud Service can call the Oracle SAAS Cloud directly or via a JCS object.

woensdag 16 december 2015

Oracle Mobile Cloud Service


Being a traditional eBS developer who touched mobile applications only slightly I had some trouble in understanding what Oracle Mobile Cloud Service actually was and offers.

I understand DBS (Database Cloud Service), which offers me a platform to run a database on so I don’t have to get myself a database and a server to run on it. I understand JCS (Java Cloud Service), which offers me a platform to run Java based applications, I also understand SAAS applications, so I don’t have to install and run ERP and Sales like applications on my own servers and maintain them.
And the nice thing is that in the cloud you have the newest features and monitoring is done in the service centers.

But now for MCS, Mobile Cloud Service (not that Messaging Cloud Service has the same acronym somehow).

 

You don’t run your mobile application on the mobile cloud service: you run it on a mobile device right. Like for an ADF application you would still build the app in your IDE, for example JDeveloper. For your ADF application you could deploy it on the Java Cloud Service and run the application from there. For your mobile application, assuming I would build it for example in MAF (JDeveloper with MAF extension) I would deploy it to the mobile device that needs to run it.

 

So why do I need a mobile cloud service then? What does it actually offer?
Like I said, your mobile app is not deployed on it, but it sort of runs through it. The main key here tying everything together being the mobile backend. It provides a layer between your mobile app

and the API’s you are calling and in the same time offers you common services like storage, (push) notifications, offline options and analytics on your services that are being called.


It’s also a kind of hub to register all the API’s you want to call. So rather than having to build in all kinds of methods to call services from external sources (in all kinds of different ways probably), you register the APIs in a uniform manor on the MCS platform and call the APIs through MCS using the URLs  exposed by MCS.



So your mobile app does not directly connect to the services outside anymore, but all through MCS and MCS provides you an abstraction layer so you can easily implement your mobile solution without worrying about how to call the services in the outside world.



And the nice thing is that the platform also monitors the calls made to the APIs. So you can see the response time and how often certain APIs are accessed.



Next to this standard monitoring it also provides you a mechanism to monitor events that you can raise through your app. For example how often a service call was delayed and for how much time. By coding these events in your app and flush it to MCS, MCS builds analytics on that.




So pretty cool right!


So on the one hand we have the services the MCS offer which we can take a look at and secondly we like to know what we need to do in our mobile app to make it work through MCS right? In this blog I will focuss on some of the features and briefly describe how to make a connection to your mobile backend in for example your MAF application to link to your mobile back end of MCS.
 

Feature Storage


 

One of the features, the analytics, I already touched briefly above. A second feature MCS offers is storage.

 
 
 
MCS offers you different ways to store data in an easy way to for example share data temporarily or to persist small data payloads off device (documents, pictures, preferences, etc).  The nice thing about putting this logic in MCS is that it can be used cross platform.
MCS offers three methods as depicted above
1.       As externalized REST APIs
2.       MCS mobile client SDK
3.       Internal to MCS using a custom API via Node.js
In MCS you simply define your storage under your Mobile Backend. It can be shared or user isolated.
 
 
Accessing the storage can be done again using REST calls as shown below.


You can also use parameters like ?limit=10 or ?offset=20, ?orderBy=contentLength:desc, etc.
So for example
{StorageURL}/collections/emp/objects?limit=10
To query the first 10 employees of your collection.
 

Feature Notification API


A second feature is the push notifications which are supported by MCS. Since each platform operating system has its own push solution (Android using Google’s Cloud Messaging service (GCM) and iOS using Apple’s Notification Services (APNS)), the MCS provides a generic notification service and provides a custom push server for multiple platforms. The MCS client SDK provides registration with APNS & GCM and displayes and handles the notifications.
The server side part provides tracking of the registrations, sending the messages, filterable distribution lists, schedule future messages and monitors delivery.

 


 

 

 

Tying your mobile app to the MCS mobile backend

 
In order for your mobile application to flow through MCS you need to tie it together. In your application XML you add these preferences. The Back End URL, the backend ID, the application key (same for Android and iOS) and finally the anonymous key to allow for anonymous access.




 



<adfmf:preferences>


    <adfmf:preferenceGroup id="mcs" label="Mobile Cloud Service Settings">


      <adfmf:preferenceText id="mobileBackendURL" label="Mobile Backend Base URL" default="https://ptsdev-usoracle88094.mobileenv.us2.oraclecloud.com:443"/>

      <adfmf:preferenceText id="mobileBackendId" label="Mobile Backend ID" default="781ec8e7-e306-460b-846c-5c4976a0caea"/>

      <adfmf:preferenceText id="mobileBackendApplicationKeyAndroid"

                            label="MBE Application Key (Android)"

                           default="cd3a8dca-6209-4431-bad4-7061a9f9b25e"/>

 

      <adfmf:preferenceText label="MBE Application Key (iOS)" id="mobileBackendApplicationKeyiOS"

      default="cd3a8dca-6209-4431-bad4-7061a9f9b25e"/>

      <adfmf:preferenceText id="mbeAnonymousKey" label="MBE Anonymous Key" secret="false" default="VVNPUkFDTEU4ODA5NF9QVFNERVZfTU9CSUxFX0FOT05ZTU9VU19BUFBJRDppaHpybTZrUW9kXzV1bA=="/>

 
 

Application Custom Development which cloud service to use?

Some time ago I wrote an article on customizations on eBS versus customizations in Fusion (http://pamkoertshuis.blogspot.nl/2015/10/ebs-integratie-versus-fusion-integratie.html).

I described we can use a PAAS platform to build our custom solutions, being custom forms (ADF), custom processing (PL/SQL packages) and custom processes (BPEL). Now let's assume we want to move our development towards the cloud. Which cloud offering would we need from Oracle?

So let's say these are the parts we need to build a custom application.






  • Java Cloud Service
    We get a weblogic server, so we can develop our solutions in any development tool of our choice that can deploy our final solution to the weblogic server hosted on the JCS.
    So we could deploy our ADF and BPEL processing directly to JCS.
    JCS is supporting 11g and 12c. You can choose to start a JCS with 11g (PS6) or 12c (12.1.3).
  • Java Cloud Service with SAAS Extension
    Java platform specially built to deploy extension for Oracle Software as a Service offerings, including Sales Cloud, Service Cloud, and Marketing Cloud.
    Dedicated environment running WebLogic Server.
    Three pre-configured sizes available: S1 (small one-node cluster), S2 (medium two-node cluster), and S4 (large four-node cluster).
    Fully managed by Oracle.
    Applications are managed through Oracle Cloud tooling; no customer access to the underlying infrastructure is required.
    You would use this if you only integrate to SAAS, where JCS is used for a full java based Enterprise project.
  • SOA Cloud Service
    This allows as to develop SOA services directly in the cloud without the need of a local SOA suite. It doesn't provide a full fletched SOA solution, but it provides a lot of monitoring capabilities and easy to use setup screens.

  • Database Cloud Service
    Well actually you ALWAYS will need this if you are developing anything with a database to store data.
  • Integration Cloud Service
    ICS is a simple version of OSB (Oracle Service Bus) which allows you to interface data between cloud services. Adapters to external environments like Sales Cloud, Service Cloud, are out of the box. If you need more complex enrichment and translation, this solution does not provide you what you need.

    There is also a matter of cost ..currently  standard edition contains 2 connections (where each line is a connection).
Other things to consider is that for a full OTAP street you may need multiple subscriptions.

So in our case we would probably choose Java Cloud Service, build our solutions using JDeveloper and deploy them to the weblogic server on JCS. In that case you have three options as shown below.



 The full JCS offering seems the most logic one to use for full customizations.




Just another note on Developer Cloud Service, this service is for issue management, code management and to build and deploy onto Java Cloud Service. So it's not an environment with development TOOLS, but a service to help you during development process (version control, issue mgt, etc). The Developer Cloud Services comes free with Java Cloud Service.
It also includes the compute unit (Compute Cloud Service).

dinsdag 15 december 2015

JDeveloper MAF Android Emulation

During a simple tutorial/training to run a MAF application that was pre-build from my JDeveloper 12 version I was going from one installation to another before I got something to work.

Follow these steps to emulate your MAF application build in JDeveloper on an Android device ..

1. Make sure MAF Extension is installed in JDeveloper.
Choose Help, Check for Updates and check the MAF Extension to install it.

2. Install JDK 8, which MAF needs
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

3. Download the Android SDK
http://developer.android.com/sdk/installing/index.html?pkg=tools

4. Generate a key store for your Android keys.

First make sure you know the java home on your machine.
 
Then open a cmd windw and navigate to that directory. Now type

keytool -genkey -v -keystore mykey.keystore -alias mykey -keyalg RSA -keysize 2048 -validity 10000

I had some issues with the - when I copied it from Step 6 Deploy and Test the application
http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_app/tut_jdev_maf_app.html

Make sure you remember the password :-).

5. Make sure you install the packages as described in the Android SDK
http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_setup/tut_jdev_maf_setup_2.html

Don't forget this step
To use the Intel x86 Emulator Accelerator, once downloaded, you then must then install the drivers.
To install the Intel HAXM executable, search your hard drive for IntelHaxm.exe.

Navigate to Windows Explorer and locate the <android_home>\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe file. Double click it and you can use the defaults while it installs.

6. In JDeveloper make sure you set the MAF Android settings as described in Step 6
http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_app/tut_jdev_maf_app.html

If you would deploy now you would get
Failed to detect a connected Android emulator.  Make sure the emulator is running.  Otherwise, manually restart the ADB server.  The following results were provided by ADB:
List of devices attached

Because you have to do step 7 first, start the emulator.

7. Start the Emulator using the SDK Manager at the location where you installed the Android SDK.
See step 22 at
http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_setup/tut_jdev_maf_setup_2.html

AVD Name = MAF
Device = Nexus 7
Target = Android 5.0.1 - API Level 21
CPU/ABI = Intel Atom (x86_64)
Internal Storage = 200 MiB
Skin = No Skin
Front Camera = Emulated
Back Camera = None
Memory Options Ram = 1024
SD Card = 640 MiB
Use Host GPU = Selected

If you get
Starting emulator for AVD 'MAF'
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!


You forgot step 5 :-).

zondag 13 december 2015

eBS and Java

Each time I get a new PC it's a pain to get eBS working with Java .. so I wrote myself a document on all the steps to verify whenever I wasn't able to install the plug-in. If I can only help out one fellow victim my mission is achieved :-).



I have Java7 installed, both 32 and 64 bit version (ignore the dutch in the picture). Then under internet options you add your websites to trusted websites.






At Configure Java (from version 7) you have to Enable Java and configure the exception site list.





Ofcourse you have to allow for popups and in some cases you still have to open the URL using Ctrl- to avoid the popups being blocked ..
Choose the settings, InternetOptions, tabpage Privacy. You can still have popup-blocking except for a list of sites. Add your site to this list if necessary.





Fetch GL Period based on date

To fetch the period name based on a specific date you can use a query like below. In The period statuses table you'll find a record for each application that is using it, so make sure you add this to your where clause (could be AR, SQLAP, etc).

SELECT  L.Ledger_Id
,       L.Period_Set_Name
,       P.Show_Status
,       P.Start_Date
,       P.End_Date
,       P.Period_Name
,       P.Adjustment_Period_Flag
,       A.Application_Short_Name
FROM    GL_LEDGERS L
,       GL_PERIOD_STATUSES_V P
,       FND_APPLICATION A
WHERE   L.Name            = mo_utils.Get_Ledger_Name(fnd_profile.value ('ORG_ID') )
AND     L.Ledger_Id       = P.Ledger_Id
AND     P.Application_Id  = A.Application_Id
AND     P.Period_Type     = L.Accounted_Period_Type
AND     Sysdate BETWEEN P.Start_Date AND P.End_Date
AND     A.Application_Short_Name = 'SQLGL'
AND     P.Adjustment_Period_Flag = 'N'
;

Getting my first ADF app to work

Since I'm a traditional eBS and forms developer, moving towards ADF was quite a step. The tutorials seemed easy enough, but getting your first actual application to work is always much more difficult since you always run into those errors that you don't encounter in your tutorials and training sessions and they are so good in explaining what the errors are and what you should  do to fix it right?
So after quite some google-hours I decided to blog here all the issues I've encountered so far in the hope to help someone else a lot quicker to fix things!

Unable to reserve the .lok file for Integrated Weblogic Server (IntegratedWeblogicServer)


When JDeveloper closes unexpected without shutting down IntegratedWebLogicServer, trying to start IntegratedWLS next time, gives "Unable to reserve the .lok file for Integrated WebLogic Server (IntegratedWebLogicServer)."

First Solution is to kill the process in Task Manager. Open Task Manager & check for java.exe process for higher memory consumption. End the process.

IF above does not help then go to C:\Users\RRA\AppData\Roaming\JDeveloper\system11.1.2.1.38.60.81\DefaultDomain . Delete the edit.lok file.


The task cannot be processed further until the current edit session is activated

 Actually, that is not an error. Login to the weblogic console and activate the changes.




Check your preferences to make sure you switch this off so you don't have to activate the changes every time you deploy.


Package weblogic security does not exist


Using Weblogic 10.3, I found that in order to follow the documented steps for creating an ADF Faces login page, I also needed to create a new JDeveloper library containing the following classpath entries and add this new library to my ViewController project. 

modules/com.bea.core.weblogic.security.auth_1.1.0.0.jar
oracle.wlserver_10.3/server/lib/wls-api.jar

This allowed my project to compile since it resolved the following imports from the code sample

 import weblogic.security.SimpleCallbackHandler; 
import weblogic.security.services.Authentication;
import weblogic.servlet.security.ServletAuthentication; 


Navigate to Project Properties, Libraries, Classpaths. I picked the libraries from weblogic.jar in the /server directory.




weblogic.application.ModuleException: Context path '/xxx' is already in use by the module: xxx application

In this case I choose the incorrect deployment profile. I created too many deployment profiles that looked too much the same with the same applications. You should not do that.

No META-INF/application.xml and no modules could be found in it


  • Make sure you have war file created for the UI project 
  • Check the Deployment Profile of the ADF application to see if the UI project is selected (application properties -> application assembly->select UIProject->check the assembly)



this project has no default run target jdeveloper



Well, actually my problem was simply I wasn't starting the run from the main page :-).


In JDeveloper, an application can be deployed to the internal weblogic server by selecting an entry in the project navigator and choosing "Run" from the context menu. JDeveloper then also prints the target URL through which the application can be accessed to its console.

Which file is actually used as the application's starting point and how the target URL is constructed can be defined in the "Run configuration" of the project (usually the ViewController project). Select the ViewController project, and then from the context menu choose "Project Properties". In the "Project Properties" dialog, select the "Run/Debug/Profile" section from the tree on the left, and then edit the run configuration. The "Edit Run Configuration" dialog is shown (click to enlarge):
 


In the "Edit Run Configuration" dialog, there are two sections which define the default run target:

  • "Launch Settings" defines the file to use as the run target. This can for example be an ADF task flow file such as adfc-config.xml for the unbounded task flow or a particular .jspx file. Below is the option "Attempt to Run Active File before Default": this influences whether JDeveloper shall always use the file provided above, or, when a particular file is currently selected in the project navigator, JDeveloper shall first try to use that file as the run target.

  • In case the default run target is an ADF task flow, there is a second section in the "Edit Run Configurations" dialog which needs to be considered: "Launch Settings => ADF Task flow". There, the actual task flow to execute by default is defined.