我正在使用MobileFirst CLI 7.1。我正在按照教程(https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/integrating-mfpf-sdk-in-cordova-applications/)幾乎一切正常。我現在用的是RSSAdapter和我不斷收到以下錯誤,當我部署應用程序到手機上:Mobilefirst 7.1適配器 - CLI
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>
----- RSSAdapter-impl.js ---
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';
}
--- JS ---
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));
}