Worklight 5.0.6 Dojo code migration - ibm-mobilefirst

I have develop a simple application on worklight 5.0.5 and it's working fine but after updating to version 5.0.6 I am facing some issues. When I launch the application dojo's libs are not integrated with my application.
Can any one help me regarding this? Thanks,
It give me the following error
Uncaught TypeError: Object function klass() {
this.initialize.apply(this, arguments);
} has no method 'setConnected'

See the Worklight 5.0.6 InfoCenter for details on code migration when you upgrade: http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m6/topic/com.ibm.worklight.help.doc/devenv/r_migrating_to_a_newer_version_of_ibm_worklight.html
If you created your current project with an earlier version of IBM
Worklight Studio, consider migrating the code to the new Dojo module
loading technique in addition to upgrading the Dojo toolkit. It
ensures that the code performs more reliably and that the page
continues to work when it makes further changes in RPE.
Specifically, the Dojo layers are no longer loaded from HTML elements,
but instead they are loaded by require() calls inside the
wlCommonInit() method. The individual modules are loaded from
require() calls inside the dojoInit() method.
Here is the link to the specific Dojo 1.8.3 code changes: http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m6/topic/com.ibm.worklight.help.doc/devenv/t_dojo_183_code_migration.html

Related

Has anyone had any success using Dojo in Liferay 7 (Liferay DXP)

We are currently trying to include Dojo in our liferay 7 application and are running into major difficulties, as it seems the AMD loader is clashing with the AMD loader of Liferay, and its preventing Dojo's define and require from working properly.
If anyone as a solution to getting dojo into Liferay 7 I would appreciate any advice or tips you have for getting this to work.
When using dojo application together with Liferay I could suggest you:
Keep dojo loader requiring only AMD modules from dojo and not Liferay, so use dojo only for dojo and Liferay only for Liferay.
Same when building the application, you need to have two separate build processes, dojo uses it own tools called dojo/util and you won't be able to easily build a dojo app using another builder.

MobileFirst AppCenter: Error while calling an adapter from iphone on login

I need to customize the login step of the MobileFirst AppCenter in order to make a call to an external service that creates the user in the DB if it doesn't exists, before performing the out-of-the-box login with the user provided.
In order to do this, I created and deployed an adapter that makes the call to the db, and in the AppCenter project, and I modified the code in the script /common/js/appcenter/views/Login.js (which is the script that actually performs the login), to include a call to the aforecited adapter, using the default method:
WL.Client.invokeProcedure(invocationData,options)
Building and running the app on Android, it works fine, the call to the adapter works like a charm and it creates the user and then performs the log in.
However, building and running on IOS, i stumble on the following error when trying to call the adapter through the invokeProcedure method:
Method 'getWlSignedClientId:' not defined in Plugin 'WLAuthorizationManagerPlugin'
The WLAuthorizationManagerPlugin is defined in the iphone config.xml in this way (i was getting a plugin missing before first):
<feature name="WLAuthorizationManagerPlugin">
<param name="ios-package" value="WLAuthorizationManagerPlugin"/>
</feature>
The error seems to be in the default plugin WLAuthorizationManagerPlugin defined in worklight.js, which I have no control on, and it basically prevents me from using the invokeProcedure method (however it works on Android).
Any help please?
Thank you.
It is unclear what version and build of MobileFirst are you using. I suggest that you will attempt again by downloading the latest iFix from IBM Fix Central, and use the new/fresh project for the AppCenter Installer app, and try again. The App is a regular Hybrid app that that you need to build in MobileFirst Studio, so ensure you are using an up-to-date build of it as well. This is where the SDK is then added to the project and should contain the mentioned "missing" plug-in.

Unable to set up jquery mobile project with worklight 6.1

I am unable to set-up a IBM Worklight project involving jquery-mobile. Here are my environment details:
eclipse Version: Juno Service Release 2 (32-bit version since I am using jre1.6.0_41)
Worklight version: 6.1.0.01
jquery-mobile: 1.3.1
I can create a new worklight project (called MyLab1) and associate jquery-mobile CSS and JS files to it. However the problems are:
The default .html file gets created as index.html (under 'apps->MyLab1->common') while my expectation is it should be MyLab1.html (as per the training material I have from IBM Worklight)
The 'Mobile Navigation' pane is completely blank while my expectation (again as per training material) is I will see a 'page(default)' control there
Whenever I try to create a new control (under 'Mobile Navigation' pane) I get the error 'Mobile Navigation controls cannot be added to the current page. This feature is only enabled for projects which have jQuery Mobile or Dojo mobile available'
I do not see any option (under eclipse menu) to start or stop Worklight sever (that comes with Developer studio version)
I am fairly new to Mobile application development space (just started with IBM worklight set up this week) and given the above issues I believe I may be doing something fundamentally wrong.
Starting Worklight 6.1, it is very much expected for a new application filenames' to be main.js, main.css and index.html.
Additionally, while you can do the adding of jQuery Mobile by yourself, you should instead use the wizard Worklight Studio provides for you.
This way not only will the files you choose be added properly to your project, but the HTML file will be updated accordingly as well (HEAD references, initial jQuery Mobile template in the body element).
The Palette view should then also list the relevant jQuery Mobile widgets you can use in your app.
Please follow the Worklight 6.1 training modules if you intend on using Worklight 6.1.
My impression is that you are reading the Worklight 5.0.x training modules.
To start or stop the Worklight Server, you need to open the Servers view and click either the play or stop buttons.
Use the keyboard shortcut Ctrl+3 and write "server".
Everything works: http://i.stack.imgur.com/K1G8O.png
I found the solution after trying out a few things. It turned out that WL-6.1.x doesn't work well with JRE 6 (32 bit) and eclipse Juno (32 bit) combination. Once I switched to JRE7/Juno-64 bit; things apparently started to work (for now at least).
Thanks Idan for your helpful comments

IBM Worklight 6.0 - Controlling Dojo Layers

The question concerns how to use the Dojo tooling in Worklight Studio 6.
I am using Worklight Studio 6.0.0.20130926-1933 as a a plugin for my Juno Eclipse on a macbook.
I want to use Dojo, and to use a few more Dojo components than are delivered in the standard layers. So, when creating my project I selected the option to add Dojo Toolkit and took the New Dojo Library option, in the dialogue that appears I stayed with the "provided" dojo, and expanded the "select Dojo components to be included" section - this shows all the optional Dojo modules, including ones I want to use (for example dojox/form/Manager).
Having finished that selection I see some layer files have been created in my new DojoProject and they are copied to the www directory of my Worklight project, however so far as I can see the extra Dojo modules are not present in the layers - a search for dojox/form finds nothing, and my app's attempt to require "dojox/form/Manager" fails.
I can work round this by manually building layers and loading them, but I assume that I'm not using the tool correctly.
What is the correct way to use the Worklight tools to control the layer contents?
Transpires that the selected Dojo components are available for use but do not get included in any layers. The dojo components are available for serving via the Dojo Libarary Requests capability.
Seems that at present if we need to get those extra files into layers then we are required to use the Dojo layer building scripts by hand and copy the results in the Worklight project's wwww directory.

IBM Worklight 6.0 - Worklight Starter Dojo example broken?

I've installed Worklight 6 in an instance of Eclipse Juno and I am wanting to migrate working apps into it from Eclipse Helios and Worklight 5. I am running into some strange problems, possibly because of the transition to Dojo 9 or maybe the new directory structure of the resident Dojo files. So I decided to start with the examples. I use Dojo in my apps, so I downloaded the WorklightStarter_DojoMobile eclipse project and imported it. I did the 'build and deploy' step, and also deployed the WorklightStarterAdapter.
I am trying to run the app in the browser simulator and it appears to be busted. I get the 'about' view but no feeds. I ran it with Firebug and the console shows a lot of peculiar errors.
I won't paste in the network links but a lot of files are not found:
WorklightStarter_DojoMobile/apps/services/preview/WorklightStarter_DojoMobile/android/1.0/default/cordova_plugins.json not found
WorklightStarter_DojoMobile/apps/services/preview/WorklightStarter_DojoMobile/android/1.0/default/dojo/core-web-layer.js not found
WorklightStarter_DojoMobile/apps/services/api/WorklightStarter_DojoMobile/android/init unauthorized
/WorklightStarter_DojoMobile/apps/services/preview/WorklightStarter_DojoMobile/android/1.0/default/dojox/mobile/themes/android/android-compat.css
Procedure invocation error. White spaces are required between publicId and systemId. Failed to parse the payload from backend (procedure: HttpRequest) with transformation...
Indeed, the Worklight Starter Dojo Edition is not fully compatible with Worklight 6; instead, you can use the Dojo examples from the training materials.