我必须安排停机时间才能在生产服务器上做一些事情.我的客户希望我向所有订阅的用户发送推送通知,以便通过停机时间通知他们.
那可能吗?如果我想通过代码来实现它会有可能吗?我正在使用worklight 6.0.0.0
如何从其他适配器的方法调用一个适配器的方法?
假设我有两个适配器:
1.具有ReadFile方法的ReadAdapter.
2.具有CreateFile方法的CreateAdapter
现在我想从CreateAdapter的CreateFile方法调用ReadAdapter的ReadFile方法.
是否可以在Worklight 6.1中使用
我用这种方法创建了一个适配器:
function getLocation(gpsLat, gpsLong) {
path = "/maps/api/geocode/json?latlng=" + gpsLat + "," + gpsLong + "&sensor=false";
var input = {
method : 'get',
returnedContentType : 'json',
path : path
};
return WL.Server.invokeHttp(input);
}
Run Code Online (Sandbox Code Playgroud)
适配器配置是这样的:
<displayName>GPSLocator</displayName>
<description>GPSLocator</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>maps.googleapis.com</domain>
<port>80</port>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
<proxy>
<protocol>http</protocol>
<domain>15.1.0.111</domain>
<port>8080</port>
</proxy>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getLocation" />
Run Code Online (Sandbox Code Playgroud)
当我右键单击并运行Invoke WL Adapter时,我收到此错误:
{
"errors": [
"Runtime: …Run Code Online (Sandbox Code Playgroud) 我们在IBM MobileFirst v.6.3中遇到了ChallengeHandler的submitAdapterAuthentication()方法的问题.
我们将回调函数分配给options对象中的属性'onSuccess'和'onFailure' .
然后,我们提供options对象以submitAdapterAuthentication(invocationData,options)并执行它.
var ch = WL.Client.createChallengeHandler(securityTest);
//////////////////
function login (user, pass) {
tempUser = {username: user, password: pass};
userObj.user = user;
var auth = "Basic " + window.btoa(user + ":" + pass);
var invocationData = {
parameters: [auth, user],
adapter: "SingleStepAuthAdapter",
procedure: "submitLogin"
};
var options = {
onSuccess: iWon,
onFailure: iLost,
invocationContext: {invocationData: invocationData},
timeout: 10000
};
ch.submitAdapterAuthentication(invocationData, options);
});
function iWon(response) {
WL.Logger.debug('Login success! Response: ' + JSON.stringify(response));
//update user info, as …Run Code Online (Sandbox Code Playgroud) 在MobileFirst Foundation中,将JSONStore添加到Windows 8.1 Universal环境会将以下文件添加到项目中:Msvcr110.dll
Sqllite3.dll
JSONStoreWin8Lib.dll
要创建包并验证它以进行发布,我使用Visual Studio在Windows 8本机中打开.sln文件,单击项目发布(project-> store-create application package)以启动该过程.
验证过程失败并显示错误:'msvcr110.dll不受支持'只有通过MS商店验证才会出现错误.
我该如何解决这个错误?
我在MFP V8.0中编写了一个适配器程序.通过安全检查确保此过程.我想在调用此适配器过程之前检查用户是否已登录:
过程映射到范围如下:
<procedure name="searchData" scope="restrictedResource"/>
Run Code Online (Sandbox Code Playgroud)
安全检查定义如下:
<securityCheckDefinition name="UserValidationSecurityCheck" class="com.sample.UserValidationSecurityCheck">
Run Code Online (Sandbox Code Playgroud)
我也完成了服务器的Scope Element映射.
我写了下面调用适配器方法的方法:
function callAdapterProcedure(invocationData){
var procedureName = invocationData.procedure;
var successHandler = invocationData.successHandler;
var failureHandler = invocationData.failureHandler;
var parameters = invocationData.parameters;
var isuserLoggedIn = checkForLoggedInUser();
alert('is logged in' + isuserLoggedIn);
if(isuserLoggedIn){
var dataRequest = new WLResourceRequest(getAdapterPath(procedureName), WLResourceRequest.GET);
dataRequest.setQueryParameter("params", [JSON.stringify(parameters)]);
dataRequest.send().then(successHandler,failureHandler);
}else{
hideProgressBar();
showAlert(Messages.ALERT_SESSION_TIME_OUT);
logoutWithoutConfirmation();
openLogin();
}
}
Run Code Online (Sandbox Code Playgroud)
以下是checkForLoggedInUser()方法的实现:
function checkForLoggedInUser(){
var userAlreadyLoggedIn = undefined;//WL.Client.isUserAuthenticated(mrmGlobal.realms.authenticationRealm,null);
WLAuthorizationManager.obtainAccessToken("restrictedResource").then(
function (accessToken) {
alert("obtainAccessToken onSuccess");
userAlreadyLoggedIn = true;
},
function (response) {
alert("obtainAccessToken …Run Code Online (Sandbox Code Playgroud) 我在 IBM MobileFirst 8.0 中使用 Angular。我正面临 WLAuthorizationManager.obtainAccessToken() 的问题
我正在使用下面的代码。
WLAuthorizationManager.obtainAccessToken()
.then(
function (token) {
console.log(token);
},
function (res) {
console.log(res);
})
Run Code Online (Sandbox Code Playgroud)
但是,我总是收到以下错误。
回复:
errorCode: "400"
errorMsg: "Bad Request"
responseHeaders: {cache-control: "[no-store, no-cache, must-revalidate]", connection: "[close]", content-language: "[en-US]", content-security-policy: "[default-src 'self';]", content-type: "[application/json]", …}
responseText: "\"Invalid request body - JSON mapping failed.\""
status: 400
statusText: "Bad Request
Run Code Online (Sandbox Code Playgroud)
版本详情:
科尔多瓦插件-mfp:8.0.2021031007
ibm-mfp-web-sdk:8.0.2021011205
该项目已在 mfp 控制台中创建。
任何帮助将不胜感激。谢谢!
我正在将worklight 6.1用于我的移动应用项目.我的问题是为什么当我尝试构建我的Android应用程序时出现此错误.
[2014-02-18 15:36:12] FWLST1040E: android build failed: java.io.FileNotFoundException: File '/var/folders/1k/k94ws4g107bgncjlp0_0vlwr0000gn/T/wlBuildResources/6.1.0.00.20131126-0630/environments/base/android/obscurerArgs.txt' does not exist
Run Code Online (Sandbox Code Playgroud)
为什么?