User bio
404 bio not found
Member since Nov 16, 2016
Replies:

Thanks for this detailed article but have a few questions in mind ( probably you might have faced/answered when you have implemented this solution) 

1) These CI/CD builds on the corresponding servers are Clean build ? If the commit is about deleting 4/5 classes unless we do a "Delete" Exclusive/all files on the servers regular load from Sandbox may not overwrite/delete the files that are present on the Server where we are building ? 

2) Are the Ensemble Production classes stored as One Production file but in different versions (with Different settings) in respective branches ? or dedicated production file for each Branch/Server so Developers merge Items (Business Service, Process etc) as they move them from one branch to another ? what is the best approach that supports this above model ? 

Hi Neil,

Thanks for your answer.

I believe it's just the way the POSTMAN console outputs the headers.

Good news is that we finally got it working. After playing a bit with %Net.HttpRequest class we created a utility test class method -  below - where we stopped using the ..Adapter.PostURL() method of the adapter class and called the Post() method of the http request class. We played a bit with the parameters in the header and voila!  we were able to move past the authorization stage:

ClassMethod CallDocmanAPI(pURL As %String, pToken As %String) As %Status
{

Set pOutput=$$$NULLOREF
Set tAdapter = ##class(EnsLib.HTTP.OutboundAdapter).%New()
set tStream = ..TestJsonReader()
!,tStream.Read(tStream.Size)
do tStream.Rewind()

!,"URL : "_pURL

Set pResponse = ##class(UCLH.SIP.Test.REST.DocmanResponse).%New()

#dim tHttpRequest As %Net.HttpRequest
#dim tHttpResponse As %Net.HttpResponse

set tHttpRequest = ##class(%Net.HttpRequest).%New()
set tHttpRequest.ContentType="application/json"
set tHttpRequest.ContentCharset="UTF-8"
set tHttpRequest.FollowRedirect=1
Set tHttpRequest.Https=1
Set tHttpRequest.Port=443
set tSC = tHttpRequest.SetHeader("content-type", "application/json")
set tSC = tHttpRequest.SetHeader("accept","*/*")
set tSC = tHttpRequest.SetHeader("authorization","Bearer "_pToken)
set tSC = tHttpRequest.SetHeader("host","api-demo.docmansandpit.com")
set tSC = tHttpRequest.SetHeader("accept-encoding","gzip, deflate")
set tSC = tHttpRequest.SetHeader("cache-control","no-cache")
set tHttpRequest.SSLConfiguration="TestDocman" 
set tSC = tHttpRequest.EntityBody.CopyFrom(tStream)

!,"HTTP HEADER: ",!,tHttpRequest.ReturnHeaders()
try {
Set tSC=tHttpRequest.Post(pURL,2,1)
Throw:$$$ISERR(tSC) ##class(%Exception.StatusException).CreateFromStatus(tSC)
}
catch (ex) {
Set tSC = ex.AsStatus()
!,$System.Status.GetErrorCodes(tSC)_" : "_$System.Status.GetErrorText(tSC)
Quit 
}
Quit tSC
}

Kind Regards.

Hi there,

We have been trying to replicate the same type of header as in POSTMAN -requests from POSTMAN work  fine and we are able to publish to the API- currently we are sending the following:

ENSEMBLE HTTP HEADER: 
User-Agent: Mozilla/4.0 (compatible; Cache;)
host: api-demo.docmansandpit.com
accept-encoding: gzip, deflate
authorization: Bearer 1mIiqOSRtnhHKJ1486gkiVhHglkzZiIviseCYxvdYR9PXbZ1Eg5EgZWKtuBFtdubLlQ8j1vVz-GDY0vzeZadFhYbCBMXVrcPYVI8qVhT8OmxHW4QaFZea-0_elL6iX6T71rDYvMm5R0kYwNduBvkqMXQyEtDkCpFlQE1ollPRtGwm1qCgTF1dH0OcsUt5cL2Z37ESO9zqE5EXmIM4h6tuOBJaS7SiF5xaUyhmZUkpTBDwJi72V39SDIGJg6FU0qP2DYUOe7mppBE2STwj9jjyRB0x3r02XBwotJ9tG6G1tbLxkiEJwIUUOqX_NJKeV1mCi2kY-2KV1ZEC9G2BPniuA
cache-control: no-cache

POSTMAN HTTP HEADER:
cache-control:"no-cache"
postman-token:"85d29666-2e8d-41c2-b8a3-3d77cd070494"
content-type:"application/json"
authorization:"Bearer 
1mIiqOSRtnhHKJ1486gkiVhHglkzZiIviseCYxvdYR9PXbZ1Eg5EgZWKtuBFtdubLlQ8j1vVz-GDY0vzeZadFhYbCBMXVrcPYVI8
qVhT8OmxHW4QaFZea-0_elL6iX6T71rDYvMm5R0kYwNduBvkqMXQyEtDkCpFlQE1ollPRtGwm1qCgTF1dH0OcsUt5cL2Z37ESO9z
qE5EXmIM4h6tuOBJaS7SiF5xaUyhmZUkpTBDwJi72V39SDIGJg6FU0qP2DYUOe7mppBE2STwj9jjyR
B0x3r02XBwotJ9tG6G1tbLxkiEJwIUUOqX_NJKeV1mCi2kY-2KV1ZEC9G2BPniuA"
user-agent:"PostmanRuntime/6.4.1"accept:"*/*"
host:"api-demo.docmansandpit.com"
accept-encoding:"gzip, deflate"
content-length:1255

The 3rd party API keeps responding with 401:  Unauthorized codes back.

We had a look at the documentation for the %Net.HttpRequest class and it states it supports BASIC Http authorization (user:password), does that mean that the http request class doesn't support Token Authorization?

Kind Regards.

Certifications & Credly badges:
Arun has no Certifications & Credly badges yet.
Global Masters badges:
Arun has no Global Masters badges yet.
Followers:
Arun has no followers yet.
Following:
Arun has not followed anybody yet.