Reputation: 1
I am trying to create a http adapter to get my user information using SOAP, I don't know how to setup my basic authorization like i setup using the soapUI tool.
Without adding basic authorization(username + password), i cannot access this web service. How do I proceed?
SoapAdapter.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);
}
Upvotes: 0
Views: 454
Reputation: 17812
You don't say which version of MobileFirst Platform you are using, so I will assume 7.0.
Assuming you mean HTTP Basic Authentication, which it looks like you do, and the values are the same for every invocation of the backend service, typically you want to modify the <authentication>
element of the adapter's .xml
file, like this:
<authentication>
<basic/>
<serverIdentity>
<username>${user}</username>
<password>${password}</password>
</serverIdentity>
</authentication>
See here in the Knowledge Center for more information.
Don't forget to make sure your adapter itself is adequately secured. Otherwise, you risk exposing what was a secured service in an unsecured way.
Also, I'm assuming your back-end service is connected to over HTTPS, to ensure that the credentials are protected.
Upvotes: 1