User bio
404 bio not found
Member since May 5, 2017
Posts:
Gertjan has not published any posts yet.
Replies:
Gertjan Klein · Dec 14, 2025 go to post

I'd just use def1arg:

#def1arg FMT(%parms) ##class(Very.Very.Long.Class.Name).Format(%parms)

(From memory, I don't have an instance to test available at the moment.) The macro 'intellisense' doesn't help with the parameters anymore, but in your case they are very easy to remember: format, args. I use something like this myself.

Gertjan Klein · Apr 17, 2025 go to post

As far as I know, %File does not allow setting the file encoding. The %Stream.FileCharacter class Dmitry mentions does, but it's not called encoding. To use UTF-8, you need to set property TranslateTable to "UTF8" (no dash).

Gertjan Klein · Sep 21, 2023 go to post

When an error has occurred, the return value is not 0. Instead, it is a %Status, and likely already contains the error information you need.

As to your actual question, finding (the id of) the response message header is not trivial. Ensemble Business Services have a %RequestHeader property from which you can take the CorrespondingMessageId, but unfortunately it is only populated if the call did not return an error status. It is still possible, though. You can use the id of the request body to find out what you need. It does need some SQL, though:

ClassMethod GetResponseHeaderId(RequestId As%String, Output sc As%Status) As%String
{
  &sql(SELECT CorrespondingMessageId INTO :ResponseHeaderId
         FROM Ens.MessageHeader
        WHERE MessageBodyId = :RequestId)
  If SQLCODE Set sc = $$$ERROR($$$SQLError, SQLCODE, $Get(%msg))
  
  Set sc = $$$OKReturn ResponseHeaderId
}

With this helper method, you can open the response message header object. Assuming the request body is called CallReq:

Set Id = ..GetResponseHeaderId(CallReq.%Id(), .sc)
  If 'sc Quit sc
  
  Set RspHdr = ##class(Ens.MessageHeader).%OpenId(Id, , .sc)
  If 'sc Quit sc
  
  $$$LOGINFO("Response is an error: "_RspHdr.IsError)

HTH,
Gertjan.

Certifications & Credly badges:
Gertjan has no Certifications & Credly badges yet.
Followers:
Gertjan has no followers yet.
Following:
Gertjan has not followed anybody yet.