我正在使用IBM MFP 8 JavaScript Adapters。根据Cordova Application的请求下面的博客或文档。
var resourceRequest = new WLResourceRequest(
"adapters/LoginAdapter/validateLogin",
WLResourceRequest.POST
);
resourceRequest.sendFormParameters(params).then(
( response ) => {
resolve( response );
}, ( error ) => {
reject( error );
}
);
我的问题是,如果我调用上面的方法,我会得到连接超时。但是,如果我传递完整的URL如下,它的工作原理。
var resourceRequest = new WLResourceRequest(
'http://xxx.xx.xx:9080/mfp/api' + "adapters/LoginAdapter/validateLogin",
WLResourceRequest.POST
);
resourceRequest.sendFormParameters(params).then(
( response ) => {
resolve( response );
}, ( error ) => {
reject( error );
}
);
如果我必须传递适配器连接的完整URL,任何人都可以确认我。
提前致谢。
更新:
当我尝试从IBM Mobile Simulator连接到适配器时,出现以下错误并且未建立连接。
ERROR TypeError: Cannot read property 'getItem' of undefined
at __WLDAO.getItem (ibmmfpf-preview.js:8285)
at getItemFromMap (ibmmfpf-preview.js:4363)
at Object.__getCachedScopeByResource (ibmmfpf-preview.js:4410)
at __send (ibmmfpf-preview.js:6776)
at sendRequestAsync (ibmmfpf-preview.js:6660)
at WL.ResourceRequest.sendFormParameters (ibmmfpf-preview.js:6577)
at HomePage.webpackJsonp.191.HomePage.login (home.ts:21)
at Object.eval [as handleEvent] (HomePage.html:18)
at handleEvent (core.es5.js:11914)
at callWithDebugContext (core.es5.js:13206)
bound @ ibmmfpf-preview.js:1334
View_HomePage_0 @ HomePage.html:18
proxyClass @ compiler.es5.js:14091
DebugContext_.logError @ core.es5.js:13146
bound @ ibmmfpf-preview.js:1334
ErrorHandler.handleError @ core.es5.js:1144
IonicErrorHandler.handleError @ ionic-error-handler.js:63
(anonymous) @ core.es5.js:9410
(anonymous) @ platform-browser.es5.js:2687
t.invokeTask @ polyfills.js:3
onInvokeTask @ core.es5.js:4140
t.invokeTask @ polyfills.js:3
r.runTask @ polyfills.js:3
invoke @ polyfills.js:3
ibmmfpf-preview.js:1334 ERROR CONTEXT