我正在学习 worklight (6.0) 教程(保险应用程序),在“Lab6_Integrate_With_Worklight_Apdaters_Part1_HTTPAdapter.pdf”一章中,我被告知如何创建一个过程并调用它。从 worklight 控制台 URL 获取 json 文件海峡工作正常,但是当我根据教程构建过程时,我无法获取 json 文件(在“调用 worklight 过程”中),并收到错误:
[ERROR ] FWLSE0099E: An error occurred while invoking procedure [project InsuranceProj]CustomerDataAdapter/HttpRequestFWLSE0100E: parameters: [project InsuranceProj]{ "arr": [
{
"method": "get",
"path": "\/apps\/services\/www\/Insurance\/mobilewebapp\/default\/json\/Customer.json",
"returnedContentType": "json"
} ] } Failed to parse JSON string <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="en-us" name="DC.Language" />...... "
我正在执行教程中的确切步骤,但无法找出问题所在....我找不到任何解决此问题的方法,希望在这里得到一些答案
XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed Materials - Property of IBM
5725-G92 (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.
-->
<wl:adapter name="CustomerDataAdapter"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>CustomerDataAdapter</displayName>
<description>CustomerDataAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>localhost</domain>
<port>10080</port>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getCustomerData">
<displayName>GetCustomerData</displayName>
</procedure>
</wl:adapter>
实现文件:
function getCustomerData() {
WL.Logger.debug("CustomerDataAdapter.getCustomerData procedure invoked");
var input = {
//headers : 'Content-Type: application/json',
method : 'get',
returnedContentType : 'json',
path : "/apps/services/www/Insurance/mobilewebapp/default/json/Customer.json"
};
return WL.Server.invokeHttp(input);
}