Hang  is not recommended to use in business component as the business component/adapter as the component or adapter will be blocked for that specified time.

However I would suggest something else in your code, to use Read($zutil(96,39)) instead of fixed value. $zutil(96,39) contains the number of characters  that a String can  hold.  If Intersystems  increase the number of characters for a string in future it will automatically take that maximum characters .

This thing happend with me before , i reported this in one WRC . This was solved automatically after few days. So i asked the engineer not to take any action on this as i thought it could be some connection issue from my end.  I guess there is some issue  with this but it was auto solved for me. I would suggest create one more connection with a different name the new connection should work. 

You can do it using below code.

set strADT ="MSH|^~\&|MEDICO|JOE'S HOSPITAL^1.2.3.4.5|OCIEB2B|OCIEUHGB2BTEST|20130730072041|SECURITY|ADT^A01|MSG00001|P|2.7|||AL"_$c(13)
_"EVN|A01|20130626044550||01|00968|20130626043902"_$c(13)
set InputADT=##class(EnsLib.HL7.Message).ImportFromString(strADT)
set InputADT.DocType="2.7:ADT_A01"  
InputADT.%Save()
 

In case you need to import it from a stream you can use ImportFromStream method to import the content from stream.

Not sure if the solution is perfect or not , but this code should work

ClassMethod ProcessJsonPayload(pInput As %Library.AbstractStream, Output pOutput As %Stream.Object = {$$$NULLOREF}) As %Status
{
  set tSC=$$$OK
  set oTempStream=##class(%GlobalBinaryStream).%New()
  set tSC=oTempStream.CopyFrom(%request.Content)
  set oCleanStream=##class(%GlobalBinaryStream).%New()
  while 'oTempStream.AtEnd {
    set content=oTempStream.Read()
    set content=$ztsrip(content,"*C")
    set tSC=oCleanStream.Write(content)
  }
  set tSC= ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(oCleanStream,"%DynamicObject",.oJsonDynamicObject)
  quit tSC
}

Please let me if this does not solve the issue.

Create a table with below properties

Class MessageStore Extends %Persistent
{

Property ReceivedTime as %TimeStamp;

Property MessageContent as %GlobalBinaryStream;

}

Now in your WebMethod create one object of a stream object.

Method GetHL7Message(Payload As %GlobalBinaryStream) As %Status[ WebMethod ]
{
  set oStreamContent=##class( %GlobalBinaryStream).%New()
  set tSC=oStreamContent.CopyFrom(Payload)
  set oTable=##class(MessageStore).%New()
  set oTable.MessageContent .CopyFrom(oStreamContent) /// Sometime directly copying does not work not sure why. Try this when exactly it can copy
  set oTable.ReceivedTime=##class(%Library.UTC).NowLocal()
  set tSC=oTable.%Save()
}

Now in your zen page show the content in a text area. using textArea.value=OStream.Read()

Let me know if you face any more problem with this.

The best way would be to transfer the cache.dat of all the namespaces. That would transfer all data , including the code.

Transfer from Com1 to Com2.

Steps :

1. Create same number namespaces in Com2

2. Unmount all databases , in Com1 and Com2

3. Copy all corrosponding Cache.dat to Com2.

4. Mount all databases in Com2.

You are ready to go. Open studio and verify the codes if they are present.

When we are extedning EnsLib.REST.Service, if we set the response code in stream attribute it would send the reponse in that way.

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap]
{
<Routes>
<Route Url="/test" Method="POST" Call="MyLib.Service.REST.TestRequestHandler:ProcessRequest"/>
</Routes>
}

-----------------

And the class contains

Class OCIELib.Service.REST.TestRequestHandler Extends %RegisteredObject
{

ClassMethod ProcessRequest(pStreamIn As %CharacterStream, Output pStreamOut As %Stream.Object) As %Status
{
// This method returns a test resonse that can be used to verify connectivity between client
// and OCIE REST endpoint.
Do pStreamOut.SetAttribute("Content-Type","application/text")
Do pStreamOut.Write("THIS IS A TEST RESPONSE FROM THE SYSTEM")
do pStreamOut.SetAttribute("ResponseCode","400 Bad Request")
Quit $$$OK
}

Hope this helps. I was also stuck here , found the solution today itself.

I have a class which extends EnsLib.REST.Service

and my URL map is as below

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap]
{
<Routes>
<Route Url="/test" Method="POST" Call="MyLib.Service.REST.TestRequestHandler:ProcessRequest"/>
</Routes>
}

-----------------

 

And the class contains

 

Class OCIELib.Service.REST.TestRequestHandler Extends %RegisteredObject
{

ClassMethod ProcessRequest(pStreamIn As %CharacterStream, Output pStreamOut As %Stream.Object) As %Status
{
// This method returns a test resonse that can be used to verify connectivity between client
// and OCIE REST endpoint.
Do pStreamOut.SetAttribute("Content-Type","application/text")
Do pStreamOut.Write("THIS IS A TEST RESPONSE FROM THE SYSTEM")

Quit $$$OK
}

}

Here calling ReportHttpStatusCode(..#HTTP400BADREQUEST, sc) does not work it seems. Is there any specific way to call the method.

 

I tried calling usinf ##class(%CSP.REST).ReportHttpStatusCode() it did not work..

Any help is appreciated.