我创建了MobileFirstPlatform-v8.0 Javascript Adapter,它调用SOAP Web服务。但我无法从我的招摇工具和WLRequest调用程序得到响应。请帮助我。
我的项目环境:带有IONIC2和AngularJS2的Mfp 8.0
目前我的SOAP服务在本地tomcat服务器上运行。
代码:
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>localhost</domain>
<port>8080</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
</connectionPolicy>
</connectivity>
<procedure name="getFeed" secured="false"/>
adapter-impl.js文件
function getFeed(type) {
MFP.Logger.error("----------------"+type);
var request =
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://jee.javapapers.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<q0:animalType>
<q0:animal>{type}</q0:animal>
</q0:animalType>
</soapenv:Body>
</soapenv:Envelope>;
MFP.Logger.error("-----request ----"+request);
var input = {
method: 'post',
returnedContentType: 'xml',
path: '/animalType.asmx',
body: {
content: request.toString(),
contentType: 'text/xml; charset=utf-8'
}
};
var result = MFP.Server.invokeHttp(input);
return result.Envelope.Body;
};
invokeAdapter(){
var resourceRequest = new WLResourceRequest("/adapters/HTTPSOAP/getFeed/",WLResourceRequest.POST);
resourceRequest.setQueryParameter("params", "['world']");
resourceRequest.send().then((response) => {
console.log("success"+JSON.stringify(response));
},
function(error){
console.log("---failed--->"+JSON.stringify(error));
});
}
错误mfp消息日志:
FWLST0904E:调用过程时抛出异常:{0} in adapter:{1} Http请求失败:java.net.SocketException:Connection 重置
感谢提前......