我创建了一个 HTTP 适配器并尝试调用一个 SOAP 请求。但我收到以下错误:
{
"errors": [
"White spaces are required between publicId and systemId.",
"Failed to parse the payload from backend (procedure: HttpRequest)"
],
"info": [
],
"isSuccessful": false,
"responseHeaders": {
"Content-Length": "1164",
"Content-Type": "text\/html; charset=UTF-8",
"Date": "Mon, 06 Apr 2015 22:16:54 GMT",
"X-Powered-By": "Servlet\/2.5 JSP\/2.1"
},
"responseTime": 869,
"statusCode": 404,
"statusReason": "Not Found",
"totalTime": 910,
"warnings": [
]
}
我已经在 SOAP UI 中测试了请求并得到了正确的值。
**注意:此 wsdl 是使用其基础服务从 Oracle 客户服务和计费产品自动生成的。**
我在这里粘贴请求:http: //9.113.129.21:7500/ouaf/XAIApp/xaiserver/ CM_GETCURRENTBILL
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cm="http://oracle.com/CM_GETCURRENTBILL.xsd">
<soapenv:Header/>
<soapenv:Body>
<cm:CM_GETCURRENTBILL dateTimeTagFormat="xsd">
<!--Optional:-->
<cm:zone>CM-GETBILCNT</cm:zone>
<!--Optional:-->
<cm:accountId>?</cm:accountId>
<!--Zero or more repetitions:-->
<cm:results>
<!--Optional:-->
<cm:billId>?</cm:billId>
</cm:results>
</cm:CM_GETCURRENTBILL>
</soapenv:Body>
</soapenv:Envelope>
从 SOAP UI 运行时,我需要提供在 Adapter.xml 中提供的用户名和密码
<wl:adapter name="DemoHTTPwithAuthAdapter"
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>DemoHTTPwithAuthAdapter</displayName>
<description>DemoHTTPwithAuthAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>9.113.129.21</domain>
<port>7500</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<authentication>
<basic />
<serverIdentity>
<username>TESTER</username>
<password>ibmindia#$</password>
</serverIdentity>
</authentication>
<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="CM_GETCURRENTBILLService"/>
</wl:adapter>
这也是我的 adpater-impl.js 文件。
function CM_GETCURRENTBILLService(accountId) {
var soapRequest = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cm="http://oracle.com/CM_GETCURRENTBILL.xsd">'
+'<soapenv:Header/>'
+'<soapenv:Body>'
+'<cm:CM_GETCURRENTBILL dateTimeTagFormat="xsd">'
+ '<!--Optional:-->'
+'<cm:zone>CM-GETBILCNT</cm:zone>'
+'<!--Optional:-->'
+'<cm:accountId>'+accountId+'</cm:accountId>'
+'<!--Zero or more repetitions:-->'
+'<cm:results>'
+'<!--Optional:-->'
+'<cm:billId></cm:billId>'
+'</cm:results>'
+'</cm:CM_GETCURRENTBILL>'
+'</soapenv:Body>'
+'</soapenv:Envelope>';
var path="http://oracle.com/CM_GETCURRENTBILL.xsd";
var input = {
method : 'post',
returnedContentType : 'xml',
path : path,
headers : {
'SOAPAction' : 'http://oracle.com/CM_GETCURRENTBILL.xsd/CM_GETCURRENTBILL'
},
body : {
content : soapRequest,
contentType : 'text/xml; charset=utf-8'
}
};
return WL.Server.invokeHttp(input);
}