Ibm mobilefirst IBM Worklight 6.0-调用适配器过程时出错

Ibm mobilefirst IBM Worklight 6.0-调用适配器过程时出错,ibm-mobilefirst,worklight-adapters,Ibm Mobilefirst,Worklight Adapters,我正在学习培训模块04\u 02\u HTTP\u适配器\u-\u与\u HTTP\u通信\u返回- end_systems,可在IBM Worklight Getting Started网站上获得,调用过程时会显示错误: { "errors": [ "Runtime: Http request failed: java.net.UnknownHostException: rss.cnn.com" ], "info": [ ], "isSu

我正在学习培训模块
04\u 02\u HTTP\u适配器\u-\u与\u HTTP\u通信\u返回-
end_systems
,可在IBM Worklight Getting Started网站上获得,调用过程时会显示错误:

{
    "errors": [
        "Runtime: Http request failed: java.net.UnknownHostException: rss.cnn.com"
    ],
    "info": [
    ],
    "isSuccessful": false,
    "warnings": [
    ]
}
适配器-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';
                   }
XML文件

        <?xml version="1.0" encoding="UTF-8"?>

   <wl:adapter name="RSSReader"
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>RSSReader</displayName>
<description>RSSReader</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>rss.cnn.com</domain>
        <port>80</port> 

    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>

<procedure name="getStories"/>

<procedure name="getStoriesFiltered"/>

     </wl:adapter>

RSS阅读器
RSS阅读器
http
rss.cnn.com
80

啊哈,我终于得到了答案。我在XML文件中做了一些代理设置,我的适配器开始工作。以下是使用任何代理时必须添加的代理代码

 <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
 <protocol>http</protocol>
 <domain>rss.cnn.com</domain>
 <port>80</port>
 <proxy>
 <protocol>http</protocol>
 <domain>proxy.My_company_name.com</domain>  ----use proxy URL here
 <port>8080</port>
 <authentication>
 <basic/>
 <serverIdentity>
 <username>user</username> --------user is username
 <password>password</password> ------------Proxy Password 
 </serverIdentity>
 </authentication>
 </proxy>
 </connectionPolicy>
 <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
 <protocol>http</protocol>
 <domain>rss.cnn.com</domain>
 <port>80</port>
 <proxy>
 <protocol>http</protocol>
 <domain>proxy.My_company_name.com</domain>  ----use proxy URL here
 <port>8080</port>
 <authentication>
 <basic/>
 <serverIdentity>
 <username>user</username> --------user is username
 <password>password</password> ------------Proxy Password 
 </serverIdentity>
 </authentication>
 </proxy>
 </connectionPolicy>

http
rss.cnn.com
80
http
proxy.My\u company\u name.com----在此处使用代理URL
8080
用户------用户是用户名
密码----------代理密码

啊哈,我终于得到了答案。我在XML文件中做了一些代理设置,我的适配器开始工作。以下是使用任何代理时必须添加的代理代码

 <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
 <protocol>http</protocol>
 <domain>rss.cnn.com</domain>
 <port>80</port>
 <proxy>
 <protocol>http</protocol>
 <domain>proxy.My_company_name.com</domain>  ----use proxy URL here
 <port>8080</port>
 <authentication>
 <basic/>
 <serverIdentity>
 <username>user</username> --------user is username
 <password>password</password> ------------Proxy Password 
 </serverIdentity>
 </authentication>
 </proxy>
 </connectionPolicy>
 <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
 <protocol>http</protocol>
 <domain>rss.cnn.com</domain>
 <port>80</port>
 <proxy>
 <protocol>http</protocol>
 <domain>proxy.My_company_name.com</domain>  ----use proxy URL here
 <port>8080</port>
 <authentication>
 <basic/>
 <serverIdentity>
 <username>user</username> --------user is username
 <password>password</password> ------------Proxy Password 
 </serverIdentity>
 </authentication>
 </proxy>
 </connectionPolicy>

http
rss.cnn.com
80
http
proxy.My\u company\u name.com----在此处使用代理URL
8080
用户------用户是用户名
密码----------代理密码

使用适配器编辑问题-impl.js和xmlclose这里有人问过同样的问题-好的,这看起来像默认的HTTP适配器;你能在浏览器中访问rss.cnn.com吗?如何尝试调用适配器过程?实际上,我第一次尝试使用“”但遇到相同的错误,因此决定使用默认的HTTP adpater进行检查,但再次遇到相同的错误。当我尝试访问rss.cnn.com时,它会重定向到“”。对于“”上的rss源,我没有使用任何参数,因此在尝试使用rss.cnn.com时将参数字段保留为空,我使用的是参数“Africa”,感谢Idan的帮助。。。我得到了问题中更新的答案。我希望这将有助于其他人。