Using a Service to get data (Inbound or outbound adapters)
Hi Guys.
I'm a newbie in productions and services and I'm using this code to get HTTP response with JSON file, is a way to do this via a production service?
set Httprequest = ##class(%Net.HttpRequest).%New()
Set Httprequest.SSLConfiguration="RTLS"
Set Httprequest.Server="serverurl"
Set Httprequest.Https=1
Set Httprequest.Timeout=30
S Token="sometoken_value"
set Httprequest.ContentType="application/json"
Do Httprequest.SetHeader("Accept","application/json")
Do Httprequest.SetHeader("Authorization","Bearer "_Token)
set tSc = Httprequest.Post("/api/jobs")
//S Resp=Httprequest.HttpResponse.Data.ReadLine()
Set Resp=Httprequest.HttpResponse.Data.Read()
Quit Resp
Thanks
Rochdi,
Can you please expand on your needs. Does what you are showing above work for you or are you getting errors?
Hi Rochdi- You can refer the following link to understand basic Ensemble production concepts.
Introduction to Ensemble Productions
You can add a Business Operation with EnsLib.HTTP.OutboundAdapter
to add your code to process HTTP request & response. (See About the HTTP Adapters for further info)
Finally - the following article should further help you with your query - Interoperability: Creating Components (Business Operation)