Ibm mobilefirst Mobilefirst 7.1适配器-CLI
我正在使用MobileFirst CLI 7.1。我正在学习教程(),几乎所有的东西都很好。我正在使用RSSAdapter,当我将应用程序部署到手机上时,不断出现以下错误:Ibm mobilefirst Mobilefirst 7.1适配器-CLI,ibm-mobilefirst,mobilefirst-adapters,Ibm Mobilefirst,Mobilefirst Adapters,我正在使用MobileFirst CLI 7.1。我正在学习教程(),几乎所有的东西都很好。我正在使用RSSAdapter,当我将应用程序部署到手机上时,不断出现以下错误: status : 500 responseHeaders {5} X-Powered-By : Servlet/3.0 Content-Type : application/json Content-Length : 430 Connection : Close
status : 500
responseHeaders {5}
X-Powered-By : Servlet/3.0
Content-Type : application/json
Content-Length : 430
Connection : Close
Date : Mon, 24 Aug 2015 09:55:41 GMT
responseText : {\"statusCode\":404,\"errors\":[\"White spaces are required between publicId and systemId.\",\"Failed to parse the payload from backend (procedure: HttpRequest)\"],\"isSuccessful\":false,\"statusReason\":\"Not Found\",\"responseHeaders\":{\"Date\":\"Mon, 24 Aug 2015 09:55:41 GMT\",\"Content-Length\":\"149\",\"Content-Type\":\"text/html;charset=UTF-8\",\"Connection\":\"close\",\"Server\":\"FeedsPortal\"},\"warnings\":[],\"totalTime\":276,\"responseTime\":244,\"info\":[]}
responseJSON {9}
statusCode : 404
errors [2]
0 : White spaces are required between publicId and systemId.
1 : Failed to parse the payload from backend (procedure: HttpRequest)
isSuccessful : false
statusReason : Not Found
responseHeaders {5}
warnings [0]
totalTime : 276
responseTime : 244
info [0]
invocationContext : null
我的代码就是这样的: --RSSAdapter.xml--
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="RSSAdapter"
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>RSSAdapter</displayName>
<description>RSSAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>rss.cnn.com</domain>
<port>80</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="getStories"/>
<procedure name="getStoriesFiltered"/>
</wl:adapter>
function getStories(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'xml',
path : path
};
return WL.Server.invokeHttp(input);
}
function getStoriesFiltered(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'xml',
path : path,
transformation : {
type : 'xslFile',
xslFile : 'filtered.xsl'
}
};
return WL.Server.invokeHttp(input);
}
function getPath(interest) {
if (interest == undefined || interest == '') {
interest = '';
}else {
interest = '_' + interest;
}
return 'rss/edition' + interest + '.rss';
}
function invokeAdapter() {
var resourceRequest = new WLResourceRequest(
"/adapters/RSSAdapter/getStories",
WLResourceRequest.GET);
resourceRequest.send().then(success,error);
}
function success(res) {
console.log('Success');
console.log('res ', res);
/*console.log('Text ', res.responseJSON.rss.channel.item.length);*/
console.log('Text ', res.responseJSON);
alert("Total RSS Feed items received:"+res.responseJSON);
}
function error(error) {
console.log('Nei');
console.log('error ', JSON.stringify(error));
alert("Response error"+ JSON.stringify(error));
}
--JS---
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="RSSAdapter"
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>RSSAdapter</displayName>
<description>RSSAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>rss.cnn.com</domain>
<port>80</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="getStories"/>
<procedure name="getStoriesFiltered"/>
</wl:adapter>
function getStories(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'xml',
path : path
};
return WL.Server.invokeHttp(input);
}
function getStoriesFiltered(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'xml',
path : path,
transformation : {
type : 'xslFile',
xslFile : 'filtered.xsl'
}
};
return WL.Server.invokeHttp(input);
}
function getPath(interest) {
if (interest == undefined || interest == '') {
interest = '';
}else {
interest = '_' + interest;
}
return 'rss/edition' + interest + '.rss';
}
function invokeAdapter() {
var resourceRequest = new WLResourceRequest(
"/adapters/RSSAdapter/getStories",
WLResourceRequest.GET);
resourceRequest.send().then(success,error);
}
function success(res) {
console.log('Success');
console.log('res ', res);
/*console.log('Text ', res.responseJSON.rss.channel.item.length);*/
console.log('Text ', res.responseJSON);
alert("Total RSS Feed items received:"+res.responseJSON);
}
function error(error) {
console.log('Nei');
console.log('error ', JSON.stringify(error));
alert("Response error"+ JSON.stringify(error));
}
更新:在最近的IFIX中,默认适配器已更改为不再指向CNN。如果没有,请升级 你的项目没有问题。无论出于何种原因,创建的默认适配器似乎已停止与CNN网站合作;这件事正在调查中 同时,您可以使用来自不同项目(正在使用engadget网站)的适配器,也可以创建自己的适配器 例如,请参阅作为的一部分提供的适配器(您可以将适配器文件夹复制到MobileFirst项目,并使用“mfp push”将其部署到服务器;确保在应用程序代码中更新适配器和过程名称)