I'm not sure you can directly map from the JSON to response class in 2017. I think in the new Intersystems you can  here do this direct mapping where you add it into your message class how it maps. It's not available in 2017 as far as I'm aware. 

Id go for something like after you have the JSON Object 

set objJson = ##class(%DynamicObject).%FromJSON(response)

Set pResponse = ##class(MyMsg.PartialJson).%New()

set pResponse.ext_customer_id=objJson .ext_customer_id

...

My scenario has been:

I have a training work I did and it has File adapters for HL7. It needs to look at an IN and an OUT folder. 

To do the work also access is required to put files into the IN folder and the OUT folder. Without rights it is not possible to create these folders or access it in the docker. 

I'll have  a look at extending the dockerfile to do this. 

On reading I get why you may not want to modify a container at the runtime as it's just for getting the community version running on a non production environment (not even any sort of work environment just my own personal pc) making true use of Docker it doesn't particularly matter just as long as folders and files can be created when looking at stuff. 

Hi:

I see in the digest from this week this link . It sounds to be like what you are trying to do. 

Note this is built in IRIS not Ensemble 2018 so it may need tweaking in order to work in your build , i think it will still import with errors in the code. I don't see any headers that say Iris in it, if there is then change the word in the headers to cache. 

I believe you may encounter issues with the code in the link stating .%ToJSON. I think this may have been introduced in IRIS or at least after our version which was 2017,  there's a chance it is in 2018. You may need to use the method  .%WriteJSONStreamFromObject from the  %ZEN.Auxiliary.altJSONProvider or typing up manually the JSON string itself to avoid use of ZEN classes. If you look on my profile i asked a question recently of the .%WriteJSONStreamFromObject

Hi Thanks I already resolved the core issues when using docker.

I don't know how to update files on docked instance as will get an access denied type error

For iris installed locally not through docker as it would be easier to create files it errors with the core issue as haven't seen steps how to solve this on a non docker instance.


*** Recovery started at Sun Jan 31 10:25:11 2021
     Current default directory: c:\intersystems\iris\mgr
 
01/31/21-10:25:11:820 (16268) 2 [Generic.Event] Too many Cores (16) for InterSystems IRIS Community License.

Thank you. I think I had something along these lines and then due to /text html being returned went back on this. 

This is developed on 2016.1 So i can't easily exlude the _id and another property from JSON. It's not may tidy but it works

Set Body = ##class(%ZEN.proxyObject).%New()
  Set Body.Employee = pRequest.Employee
  Set Body.UserName = pRequest.UserName
  Set Body.ModuleName = pRequest.ModuleName
  Set Body.CompletionDate = pRequest.CompletionDate
  Set Body.CompletionDate = pRequest.CompletionDate
  Set Body.Source= pRequest.Source

Looking at it new JSON when we upgrade very soon it could be a lot tidier. 

The main stumbling block was all the responses i read use their own HTTP adapters. As soon as had class extending Ens.BusinessOperation, Ens.Util.JSON and using it's own adapter extending Enslib outbound like below it worked

Method PostURL(pURL As %String, Output pHttpResponse As %Net.HttpResponse, pFormVarNames As %String, pData...) As %Status [ CodeMode = expression ]
{
..SendFormDataArray(.pHttpResponse, "POST", ..GetRequest(), .pFormVarNames, .pData, pURL)
} ClassMethod GetRequest() As %Net.HttpRequest
{
    set request = ##class(%Net.HttpRequest).%New()
    set request.ContentType  = "application/json"
    quit request
}
   

Hi:

Thank you so much. I'm pretty much a complete beginner so just saying AttachStream took the full hour or so of trying to figure out how to implement it, so good learning exercise

Can you please check that this is the correct implementation? It works but I am aware I may have missed something that was obvious to it otherwise. I will mark as answer if it is correct. the variable file is the link to the attached file  

Set tStream = ##class(%Stream.FileBinary).%New()
Set tStream.Filename = file
Set tSC = msg.AttachStream(tStream,##class(%File).GetFilename(pRequest.InputData.OriginalFilename))
If $$$ISERR(tSC) {....

Hi:

I'm not sure if it is because we are on an older version of Healthshare. But Our version of the Ens.Util.Tasks.Purge does not contain the two fields for the send completion email? If this is the case and you have modified the Ens.Util.Tasks package you should not directly modify these classes, you should create a task that extends Ens.Util.Tasks.Purge. 

As I suspect your Ens.Util.Tasks.Purge has been manually edited to include these properties we would need to see the code of the send method to see the error 

It turns out it wouldn't suspend because the code was quitting with a $$OK rather than the status. 

It now does suspend the message but as there was no pResponse the operation still waits 15 seconds for timeout and then doesn't display in the production viewer with the purple/red dot if there was no suspending applied. Snippets that get called are below. 

Method LookupDefault(pRequest As Penn.EDT.Messages.InputData, Output pResponse As Penn.EDT.Messages.PatientLookupResponse) As %Status
{
Quit ..DoLookup(.pResponse, sql,pRequest.NHSNumber, source)
}

Method DoLookup(Output pResponse As Penn.EDT.Messages.PatientLookupResponse, sql As %String, args...) As %Status
{
    Set tSC = $$$OK
    Set pResponse = ##class(Penn.EDT.Messages.PatientLookupResponse).%New()
        Set tSC = ..Adapter.ExecuteQuery(.rs, sql,args...)
    if $$$ISERR(tSC) {
        Do pResponse.Errors.Insert($System.Status.GetErrorText(tSC))
    } Else {
        Do ..GetResults(rs,$G(args(2)),pResponse)    
    }
    
    Quit tSC
}

}

I think the error needs to give a response to the calling object, how can i do this? 

Hi:

It is from a buisness operation  Penn.EDT.BO.ElectronicLettersLookup Extends Ens.BusinessOperation
{ Parameter ADAPTER = "EnsLib.SQL.OutboundAdapter";

I would have thought it would have suspended from the following 

Set tSC = ..Adapter.ExecuteQuery(.rs, sql,args...)
if $$$ISERR(tSC) {
Do pResponse.Errors.Insert($System.Status.GetErrorText(tSC))

Yup you're 100% spot on. 

I got this to work once there then tried to sort out the error messages and it no longer correlates before realising that my firewall was starting to block the request. 

I had a lot of errors, mainly down to to Message Definition.  Will need to sort out the firewall  issue

Final code:

Method GetGPStatus(pRequest As Penn.EDT.Messages.GetGPStatusRequest, Output pResponse As Penn.EDT.Messages.ODSGPStatus) As %Status
{
Set pResponse = ##class(Penn.EDT.Messages.ODSGPStatus).%New()
Set rdr = ##class(%XML.Reader).%New()
    set httprequest = ##class(%Net.HttpRequest).%New()
    set httprequest.SSLConfiguration = "test"
    set httprequest.Https = 1
    set httprequest.SSLCheckServerIdentity=0
    Set tSC = rdr.OpenURL("https://directory.spineservices.nhs.uk/ORD/2-0-0/organisations/"_pRequest.GPCode_"?_format=xml",,httprequest)     do rdr.Correlate("Status","Penn.EDT.Messages.ODSGPStatus") If 'rdr.Next(.gpxml,.tSC) || $$$ISERR(tSC) { If '$$$ISERR(tSC) Set tSC = $$$ERROR($$$EnsErrGeneral,"Failed to correlate GPStatus")
Quit tSC
}
set pResponse.Status=gpxml.Status
    quit tSC
}

Class Penn.EDT.Messages.ODSGPStatus Extends (Ens.Response, %XML.Adaptor, )
{ Property Status As %String(XMLNAME = "value", XMLPROJECTION = "attribute"); Storage Default
{
<Data name="ODSGPStatusDefaultData">
<Subscript>"ODSGPStatus"</Subscript>
<Value name="1">
<Value>Status</Value>
</Value>
</Data>
<DefaultData>ODSGPStatusDefaultData</DefaultData>
<Type>%Library.CacheStorage</Type>
} }
 

I'm still confused:

I have it in a class method

I can't check it actually goes in the property as it's a classmethod and see no way to test it as a method to test the ..GPStatus 

I get this now from my BO

Method GetGPStatus(pRequest As Penn.EDT.Messages.GetGPStatusRequest, Output pResponse As Penn.EDT.Messages.ODSGPStatus) As %Status
{
Set pResponse = ##class(Penn.EDT.Messages.ODSGPStatus).%New()
set reader = ##class(%XML.Reader).%New()
    set httprequest = ##class(%Net.HttpRequest).%New()
    set httprequest.SSLConfiguration = "test"
    set httprequest.Https = 1
    set httprequest.SSLCheckServerIdentity=0
    Set status = reader.OpenURL("https://directory.spineservices.nhs.uk/ORD/2-0-0/organisations/Y00334?_f...",,httprequest)
    if $$$ISERR(status) quit status
    do reader.Correlate("Status","Penn.EDT.Messages.ODSGPStatus")
   $$$TRACE(..Status)
    do reader.Next()
     $$$TRACE(..Status)
    //set pResponse.Status=obj
    
    quit status
}

Doesn't like the .Next() for some reason. 

If i try without the .next i get no value