【发布时间】:2016-09-01 06:40:00
【问题描述】:
我正在尝试使用 JavaScript HTTP 适配器从 SOAP Web 服务中获取一些数据。为此,我将 MFP8 和 Ionic 与 TypeScript 一起使用。
我有以下适配器实现文件,
function getFeed(params) {
var sr =
"<soapenv:Envelope " +
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
"xmlns:len=\"targetNamespace HERE" >" +
"<soapenv:Header/>"+
"<soapenv:Body>" +
"<len:authentication>" +
"<username>"+params[0]+"</username>"+
"<password>"+params[1]+"</password>"+
"</authentication></soapenv:Body></soapenv:Envelope>";
var input = {
method : 'post',
returnedContentType : 'xml',
path : 'PATH HERE',
body: {
content: sr,
contentType: 'text/xml; charset=utf-8',
},
};
return MFP.Server.invokeHttp(input);
}
这里是adapter.xml,
<mfp:adapter name="http"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mfp="http://www.ibm.com/mfp/integration"
xmlns:http="http://www.ibm.com/mfp/integration/http">
<displayName>http</displayName>
<description>http</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>DOMAIN NAME HERE</domain>
<port>PORT NO HERE</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
</connectionPolicy>
</connectivity>
<procedure name="getFeed"/>
</mfp:adapter>
因此,按照 API 文档,我执行了以下操作以在我的 ionic 提供程序中调用适配器,
var resourceRequest = new WLResourceRequest("adapters/http/getFeed", WLResourceRequest.GET);
resourceRequest.setQueryParameter("params", "['username', 'password']");
resourceRequest.send().then(
function(response) {
alert('response '+JSON.stringify(response.responseText));
},
function(response) {
alert("HTTP Failure "+JSON.stringify(response));
}
);
因为,我需要从 SOAP 服务中获取特定数据。为此,我需要传递参数和方法。
在知识中心阅读,我发现了一些关于使用查询字符串调用参数的东西,我可以传递参数。
我的要求是也传递方法名称。
谁能告诉我如何传递方法名?
感谢任何人的帮助!!!
【问题讨论】:
标签: javascript ionic-framework ibm-mobilefirst