我正在尝试创建一个 http 适配器来使用 SOAP 获取我的用户信息,但我不知道如何设置我的基本授权,就像我使用 soapUI 工具设置一样。
如果不添加基本授权(用户名 + 密码),我将无法访问此 Web 服务。我该如何进行?
肥皂适配器.xml
<displayName>SoapAdapter</displayName>
<description>SoapAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain>www-304.ibm.com</domain>
<port>443</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>300000</socketTimeoutInMilliseconds>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
</connectionPolicy>
</connectivity>
SoapAdapter-impl.js
function getUserPro() {
var request =
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://www.ibm.com/tools/wse/ws/">
<soapenv:Header/>
<soapenv:Body>
<ws:ws_getUserCustomerOperation>
<ws:RequestedUserDetails>
<userid>my-email-address</userid>
<group>Customer</group>
</ws:RequestedUserDetails>
</ws:ws_getUserCustomerOperation>
</soapenv:Body>
</soapenv:Envelope>;
var input = {
method : 'post',
returnedContentType : 'xml',
headers:{'Content-Type':'text/xml','Authorization':'Basic ' + ('my-email-address:*******')},
path : '/easytools/runtime/uat/protect/***/Customer/webservices/ws_addProductToCartCustomer.wss?',
body: {
content : request.toString(),
contentType : 'text/xml; charset=utf-8'
}
};
return WL.Server.invokeHttp(input);
}