Mobifirst 8.0:升级MFP 7.1到8.0后,适配器无法获取数据

时间:2016-09-12 10:20:07

标签: java android cordova ibm-mobilefirst ibm-cloud

我有一个使用https://randomuser.me/ API

的个人资料适配器

adapter.xml

<wl:adapter name="comradeAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wl="http://www.ibm.com/mfp/integration"
    xmlns:http="http://www.ibm.com/mfp/integration/http">

    <displayName>comradeAdapter</displayName>
    <description>comradeAdapter</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol>
            <domain>api.randomuser.me</domain>
            <port>443</port>
            <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
            <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
            <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
            <!-- Following properties used by adapter's key manager for choosing specific certificate from key store
            <sslCertificateAlias></sslCertificateAlias>
            <sslCertificatePassword></sslCertificatePassword>
            -->
        </connectionPolicy>
    </connectivity>

    <procedure name="getFeed"/>
</wl:adapter>

comradeAdapter.js

function getFeed() {
    path = '?results=20';

    var input = {
        method : 'get',
        returnedContentType : 'json',
        path : path
    };


    return WL.Server.invokeHttp(input);
}

在我的本地,我可以成功调用数据。但是当我部署到ibm bluemix提供的mobilefirst控制台服务器8.0时,我无法获得Swagger上的数据:

请求网址

https://mydemo-tac-ha-server.mybluemix.net/mfp/api/adapters/comradeAdapter/getFeed

Response Body

no content

Response Code

401

Response Headers

{
  "x-backside-transport": "FAIL FAIL",
  "connection": "Keep-Alive",
  "transfer-encoding": "chunked",
  "date": "Mon, 12 Sep 2016 10:15:57 GMT",
  "www-authenticate": "Bearer",
  "x-powered-by": "Servlet/3.1",
  "x-global-transaction-id": "3044026435",
  "content-type": null
}

请帮助我审核并告诉我您可以从服务器mfp 8.0获取数据

1 个答案:

答案 0 :(得分:1)

要将现有适配器和应用程序迁移到MobileFirst Foundation 8.0,可以使用以下材料: