If you don't care about any unsent/completed/suspended messages, try calling the CleanProduction() method in class Ens.Director:

Do ##class(Ens.Director).CleanProduction()

This is strongly discouraged for PROD environments ... be forewarned. Would recommend you contact the WRC if you're getting this error in a PROD environment.

@Robert C. Cemper has you on the right track, but I'm curious as to whether the vendor of the foreign (i.e. non-HealthShare/HealthConnect) system has provided a specification. Do you need to accommodate Acknowledgement messages for both sending/receiving? Is there some sort of handshake protocol that is used to indicate when it's safe to send, a sort of RTS/CTS-type mechanism? Or is this being designed "on the fly?"

If I were designing something like this, I'd go with a web service ... always over the same port, and when you want to send something you'd POST it. When there's nothing to POST, you'd periodically GET to see if anything is waiting.

Anything else would most likely be a one-off in healthcare integration.

One additional modification to @Stuart.Strickland8116's most amazing attempt:

N(i)
 j=1:1:$l(i) c=$e(i,j),o=$g(o)_$s(",.!?"[c:c,c?1a:$e(" ",j>1)_$ZCVT(c,"U")_$p("lfa77harlie7elta7cho7oxtrot777ndia7777ike7ovember7scar777omeo777niform7777ankee",7,$a(c)#32),1:"")
 o

180 192 characters, assuming Unix line endings and a ridiculously limited use case that still solves the problem devil

EDIT: Added 12 characters to add fix for capitalized output ...

Hi @Eduard Lebedyuk,

I recently implemented this mechanism for handling ad-hoc message selection queries to the Google Health HL7v2 Store, and wanted to share a modification needed to satisfy the customer.

Their concern was that the service name was hard-coded in the dispatch class, and that they would have to touch the code if they used the class with a differently named service. To resolve that, I added a TargetConfigName property to the otherwise empty proxy service along with a SETTINGS parameter to reveal it through the configuration panel and allow the user to configure it.

I then modified the methods in the dispatch class to expect the service name in the URL "launch" argument and interrogate the production for the specified service's TargetConfigName value.

As always, thank you for the informative articles and answers!