Viewing httprequest in Enslib.Rest.Operation and setting pwd
The REST webservice works perfectly when run on SOAP UI. This end point server is an https site that uses basic authentication (uname and pwd). But when I run the request through an Enslib.Rest.Operation using a configured SSL and stored credentials, I get an "unauthorized" error, unless I explicitly hard code the password in the operation class. HS Version is 2014.1 .
I have 2 questions. Pardon me, they are both related!!
1: How can the httprequest object be viewed in Ensemble? It took a long time for me to actually troubleshoot this because I had no way to see the httprequest object before it was submitted. I tried using a custom outbound adapter with a DEBUG=2 but I had no idea where the request and response are written. I did not see them in the HTTP Trace log of the CSP gateway after turning on the TRACE.
2: How is the Adapter password set? I tried the following 3 ways and they all returned an "unauthorized" error.
Did not work:-
Set tCredentials = ##class(Ens.Config.Credentials).%OpenId("myCredentials")
Set ..Adapter.%CredentialsObj.Username = tCredentials.Username
Set ..Adapter.%CredentialsObj.Password = tCredentials.Password
Set tSC = ..Adapter.PostURL(..Adapter.URL,.tHttpResponse,"",pRequest.ContentStream)
Did not work:-
Set tCredentials = ##class(Ens.Config.Credentials).%OpenId("myCredentials")
Set ..Adapter.%CredentialsObj = tCredentials
Set tSC = ..Adapter.PostURL(..Adapter.URL,.tHttpResponse,"",pRequest.ContentStream)
Did not work:-
Set ..Adapter.Credentials = "myCredentials"
Set tSC = ..Adapter.PostURL(..Adapter.URL,.tHttpResponse,"",pRequest.ContentStream)
Did not work
Setting the credentials in the "Credentials" basic setting of the Operation in the Production=myCredentials.
Worked
Set tCredentials = ##class(Ens.Config.Credentials).%OpenId("myCredentials")
Set ..Adapter.%CredentialsObj.Username = tCredentials.Username
Set ..Adapter.%CredentialsObj.Password = "ACTUAL PASSWORD"
There is no way this last line can get through code review! How is this done in the real world?