Mobilefirst 8.0 cordova应用程序无法连接服务器

时间:2016-12-27 08:16:08

标签: ibm-mobilefirst

POC for MobileFirst 8.0版应用程序和我创建了示例应用程序和基于maven的适配器。最后我调用了适配器index.js文件,当我使用浏览器模拟器时调用适配器工作正常,但是当我安装android设备时它无法工作我在android LOGCAT中得到了以下错误,

[错误:xwalk_autofill_client.cc(121)]未在virtual void xwalk中实现:: XWalkAutofillClient :: OnFirstUserGestureObserved()

如何解决此问题。

请查看以下实施。

adapter
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed Materials - Property of IBM
 5725-I43 (C) Copyright IBM Corp. 2011, 2013. All Rights Reserved.
 US Government Users Restricted Rights - Use, duplication or
 disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
-->
<mfp:adapter name="HttpAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mfp="http://www.ibm.com/mfp/integration"
    xmlns:http="http://www.ibm.com/mfp/integration/http">

 <displayName>HttpAdapter</displayName>
 <description>HttpAdapter</description>
 <connectivity>
  <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
   <protocol>https</protocol>
   <domain>mobilefirstplatform.ibmcloud.com</domain>
   <port>443</port>
   <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
   <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
   <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
  </connectionPolicy>
 </connectivity>

 <procedure name="getFeed" secured="false"/>
 <procedure name="unprotected" secured="false"/>

</mfp:adapter>
adapter implementation
function getFeed(tag) {
 var input = {
     method : 'get',
     returnedContentType : 'xml',
     path : getPath(tag)
 };

 return MFP.Server.invokeHttp(input);
}

/**
 * Helper function to build the URL path.
 */
function getPath(tag){
    if(tag === undefined || tag === ''){
        return 'feed.xml';
    } else {
        return 'blog/atom/' + tag + '.xml';
    }
}

/**
 * @returns ok
 */
function unprotected(param) {
 return {result : "Hello from unprotected resource"};
}
apps implementation
function myFunction(){
 console.log('==================== inside calling ==================');
 var resourceRequest = new WLResourceRequest(
         "/adapters/HttpAdapter/getFeed",
         WLResourceRequest.GET,3000
     );

    resourceRequest.setQueryParameter("params", "['']");

    resourceRequest.send().then(
        function(response) {
         alert("------- success " +JSON.stringify(response));
        },
        function() {
         alert("----------- >>> errror ------");
        }
    )
}

1 个答案:

答案 0 :(得分:0)

请在HTML文件中使用mata标签,它将解决您的Android问题。

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'" />