Ibm mobilefirst Worklight 6.1:与BB old 6/7的Worklight连接存在问题
我正在使用worklight 6.2并构建blackberry 6/7示例应用程序,但我面临连接问题 由于连接问题,我无法调用适配器,每次我都会收到来自适配器的失败响应 下面给出了我的代码片段 config.xmlIbm mobilefirst Worklight 6.1:与BB old 6/7的Worklight连接存在问题,ibm-mobilefirst,worklight-runtime,Ibm Mobilefirst,Worklight Runtime,我正在使用worklight 6.2并构建blackberry 6/7示例应用程序,但我面临连接问题 由于连接问题,我无法调用适配器,每次我都会收到来自适配器的失败响应 下面给出了我的代码片段 config.xml <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0" rim:backButton="exit">
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0" rim:backButton="exit">
<name>bb67</name>
<description>bb67</description>
<author email="application author's e-mail">application's author</author>
<feature id="worklightFeature" required="false" version="1.0.0"/>
<feature id="blackberry.ui.dialog" version="1.0.0"/>
<feature id="blackberry.ui.menu" version="1.0.0"/>
<feature id="blackberry.invoke" version="1.0.0"/>
<feature id="blackberry.invoke.BrowserArguments" version="1.0.0"/>
<feature id="blackberry.identity" version="1.0.0"/>
<feature id="blackberry.app" version="1.0.0"/>
<feature id="blackberry.app.event" version="1.0.0"/>
<access subdomains="true" uri="*"/>
<content src="www/skinLoader.html"/>
<icon rim:hover="false" src="icon.png"/>
<rim:loadingScreen backgroundImage="" foregroundImage="splash.png" onLocalPageLoad="false" onFirstLaunch="true"/>
</widget>
如果缺少什么,请提出建议。我正在使用webworks进行建筑项目。
我使用下面的命令来构建cod文件
bbwp C:\myapp\myarchive.zip -d -o C:\myapp\output
下面是worklight项目生成的结构
请建议worklight中是否有任何关于webwork project的正确文档。根据所写的注释,在物理设备中运行应用程序时,此问题已得到解决。此设备通过WiFi连接到运行服务器的同一网络 剩下的问题是在BlackBerry模拟器中运行应用程序时,该模拟器实际上是在VMWare Fusion中运行的 如果虚拟机无法连接到您的本地网络,那么在其内部运行的应用程序也将无法连接到服务器 建议:
- 检查VM设置,确保正确设置以访问本地网络
- 您可以通过打开其中的浏览器来检查这一点,并查看是否能够访问服务器的Worklight控制台
/* JavaScript content from js/main.js in folder common */
function wlCommonInit(){
/*
* Use of WL.Client.connect() API before any connectivity to a Worklight Server is required.
* This API should be called only once, before any other WL.Client methods that communicate with the Worklight Server.
* Don't forget to specify and implement onSuccess and onFailure callback functions for WL.Client.connect(), e.g:
*
* WL.Client.connect({
* onSuccess: onConnectSuccess,
* onFailure: onConnectFailure
* });
*
*/
// Common initialization code goes here
WL.Client.connect({
onSuccess: function onConnectSuccess(res){
alert('Connection Success '+res);
},
onFailure: function onConnectFailure(res){
alert('Connection Failure '+res);
}
});
}
/* JavaScript content from js/main.js in folder blackberry */
// This method is invoked after loading the main HTML and successful initialization of the Worklight runtime.
function wlEnvInit(){
wlCommonInit();
// Environment initialization code goes here
}
var timeout = 30000;
function msiteCall(){
alert('Inside call');
var invocationData = {
adapter : "msiteAdap",
procedure : "getStories",
parameters : [],
compressResponse : true
};
//WL.Logger.debug('invoke msg '+invocationData, '');
WL.Client.invokeProcedure(invocationData, {
onSuccess : function succ(){alert("Success...");},
onFailure : function fail(){alert("Failure...");},
});
}
bbwp C:\myapp\myarchive.zip -d -o C:\myapp\output