go to post Marc Mundt · Jun 14, 2022 Ok, so the flow would look roughly like this: The GenericService accepts an inbound REST request, populates a GenericMessage, and sends it to your business process Business process extracts the JSON payload from the GenericMessage, and pulls out any relevant details needed for the call to Athena Business process creates a new GenericMessage, populates any items needed by Athena, uses %SYS.OAuth2 (and the OAuth client profile you created) to request an OAuth token and adds it to the GenericMessage, and passes the new GenericMessage to the business operation. Business operation makes the outbound REST call to Athena, and returns a new GenericMessage containing the response to your business process. Business process extracts JSON payload from the GenericMessage, uses a transformation to create the payload required by your internal REST client. Business process creates a new GenericMessage, populates it with the response payload, and returns it to the GenericService GenericService returns response to REST client
go to post Marc Mundt · Jun 14, 2022 For the outbound REST calls, I would typically create a custom operation class that calls methods in %SYS.OAuth2.* to fetch a token from the downstream system and then places that in the HTTP header. If it's essential for you to avoid creating a custom class, you could call the %SYS.OAuth2 methods from a BPL and then add the token to the header fields in the EnsLib.HTTP.GenericMessage that you send to the GenericOperation. You haven't said what needs to happen between the business service and business operation, so it's hard to discuss how everything fits together as you asked.
go to post Marc Mundt · Jun 13, 2022 You'll want to configure the passthrough service to use "Standard Requests". This means REST requests will pass through a web server (IIS, Apache, etc) to get to IRIS:https://docs.intersystems.com/irisforhealth20221/csp/docbook/DocBook.UI.... For TLS, you'll enable HTTPS on your web server. And see this docs on enabling OAuth for web services:https://docs.intersystems.com/irisforhealth20221/csp/docbook/DocBook.UI....
go to post Marc Mundt · Jun 13, 2022 Yes, the GenericService will send an EnsLib.HTTP.GenericMessage object to your business process. The GenericMessage includes the headers and content of the inbound HTTP request. Your DTL can use these fields to transform to another format. Similarly, the GenericOperation accepts the same GenericMessage type and uses the values in it to issue an HTTP request to the downstream system. So all together, this allows you to create a REST web service and/or call out to external REST services using only the GUI. https://docs.intersystems.com/irisforhealth20221/csp/docbook/DocBook.UI....
go to post Marc Mundt · Jun 6, 2022 Here's a sample class to Base64 encode a stream: Class Example.B64.Util Extends %RegisteredObject { /// Be cautious if changing CHUNKSIZE. Incorrect values could cause the resulting encoded data to be invalid. /// It should always be a multiple of 57 and needs to be less than ~2.4MB when MAXSTRING is 3641144 Parameter CHUNKSIZE = 2097144; ClassMethod B64EncodeStream(pStream As %Stream.Object, pAddCRLF As %Boolean = 0) As %Stream.Object { set tEncodedStream=##class(%Stream.GlobalCharacter).%New() do pStream.Rewind() while ('pStream.AtEnd) { set tReadLen=..#CHUNKSIZE set tChunk=pStream.Read(.tReadLen) do tEncodedStream.Write($System.Encryption.Base64Encode(tChunk,'pAddCRLF)) if (pAddCRLF && 'pStream.AtEnd) { do tEncodedStream.Write($c(13,10)) } } do tEncodedStream.Rewind() quit tEncodedStream } }
go to post Marc Mundt · May 24, 2022 Fortunately it's a simple issue. In your CALL action, you need to add a "Request Action" and set callrequest to the object you want to send to the BO. It looks like you're just modifying the inbound request so you could just set callrequest to request.
go to post Marc Mundt · May 20, 2022 If you can assume that the zip is always 5 digits and state is 2 digits, and if you can assume that the separator is always 1 character then you can do it by position: set ZIP=$EXTRACT(x,*-4,*), STA=$EXTRACT(x,*-7,*-6), CTY=$EXTRACT(x,0,*-9)
go to post Marc Mundt · May 5, 2022 Try removing the JsonArayOBJ argument from your call to SendFormDataURL. set st = ..Adapter.SendFormDataURL(..Adapter.URL,.callResponsePat,"POST",HTTPRequestPat)
go to post Marc Mundt · May 5, 2022 Can you give some more details on what's happening? Is there an error message?