this is the class:

Class REST.Test.Sample.AllItems Extends (%JSON.AdaptorEns.Response)
Property ItemtId As %String;

Property itemName As %String(MAXLEN 100);

Property itemStockNumber As %String(MAXLEN 150);

Property itemType As %String;

Property itemPriority As %String;

Property itemDetailData As %String(MAXLEN 10000);
}

 

ClassMethod getItemData() As %Status [ PublicList = (U, ItemDetails, RESULTS) ]
{
Set tSC = $$$OK
results=""
               
s AllItems=##class(REST.Test.Sample.ItemDetails).%New()
(STATUS,XX)=0 F  S STATUS=$O(^GMR(123,"D",STATUS)) Q:STATUS'>0 f  s XX=$O(^GMR(123,"D",STATUS,XX)) Q:XX'>0 d
    .CONERR=""
    .GETS^DIQ(123,XX,"*","IE","ItemDetails","CONERR")
    .Q:"5,6"'[STATUS
    .Q:$P(^GMR(123,XX,0),"^",5)'=9
    .Item=..%New()
    .Item.ItemId=XX
    .CONID=XX_","
    .itemId=$g(ItemDetails(123,CONID,.02,"I"))
    .ien=XX_","
    .Item.ItemName=$g(ItemDetails(123,CONID,.02,"E"))
    .Item.itemStockNumber=$G(ItemDetails(123,CONID,10,"I"))
    .Item.itemType=$G(ItemDetails(123,CONID,10,"I"))
   .Item.itemPriorty=$G(ItemDetails(123,CONID,11,"I"))

    .X2=0 F  S X2=$O(ItemDetails(123,CONID,20,X2)) q:X2'>0 D
    ..results=$g(results)_"|"_ItemDetails(123,CONID,20,X2)
    ..Item.ItemData=$g(results)
    .;d Item.Consult.SetAt(XX,XX)
    .s AllItems.ItemId=XX
    .AllItems.Item.SetAt(Item.ItemName,"ItemName")

    d AllItems.%JSONExport()
    200

I set the parameter and am still not see the list of the items. in my code, I am looping thru the table and when I find an item that needs to be added to the JSON message, I set the properties in the AllItems JSON message then I am trying to add the data from that object to the ItemDetails object so the ItemDetails has all the table entries that are in the AllItems object. 

so I collect and build the AllItems object for each table entry and then want to put all the AllItems data into the ItemDetails and return this JSON to the user.

Class TMP.AppointmentReqMsg Extends Ens.Request
{ // ProcessingFlag property is used to determine if the appt is for Cerner, Cerner and VistA or just VistA. // This flag is used by the BP Property ProcessingFlag As %String; Property MessageId As %String; Property ControlId As %String; Property LogicAppRunId As %String(MAXLEN = 150); Property AppointmentID As %String(MAXLEN = 150); Property AppointmentType As %String; Property StartTime As %String; Property Duration As %String; Property VisitStatus As %String; Property CancelCode As %String; Property CancelReason As %String; Property CancelRemarks As %String(MAXLEN = 160); Property ClinicallyIndicatedDate As %String; Property Comments As %String(MAXLEN = 160); Property VvdUrl As %String(MAXLEN = 500); Property SchedulerInfo As array Of SchedulerInfo; Property PatientInfo As TMP.PatientInfo; Property ProviderFacility As %String; Property PatientFacility As %String; // Property PatientResources As list Of AppointmentResources; Property PatientResources As TMP.AppointmentResources; Property ProviderResources As TMP.AppointmentResources;

***Disclaminer, I consider myself to be a fairly new Cache Objectscript developer. If any developers with more experience have suggestions for how to do this easier, more efficient, etc. Please share. I am eager to learn more that will help me in the future. :) 

I have done this in the past, I created a business service with the EnsLib.HTTP.InboundAdapter to receive the JSON message on a REST end point. I also created a class for the JSON message structure. In the business service, I receive the JSON message and pass it to a business operation. In the business operation I have a transform that transforms the JSON to HL7 message, then the business process passes the HL7 message to a business operation to send to a new HL7 end point. This code was created in Ensemble 2017. If you are using IRIS, there are more classes for JSON message handling you might be able to use.

My business service handles several different JSON messages, this is the one of the methods I have for one of the messages. In the method I convert the JSON object that was received into a new object of type TMP.AppointmentReqMsg. TMP.AppointmentReqMsg is the class that defines the JSON message structure. 

The new JSON object is passed to a business process to process the message. In the business process, I have a transform that transforms the JSON object to HL7. Then the business process will call the business operation that sends the HL7 message on to an HL7 end point.

Hope this helps.

Method appointmentAction1(pInput As %Library.AbstractStream, Output pOutput As %Stream.Object, pAppointment As %Stream.Object) As %Status
{  $$$LOGWARNING("In processing appointments")  #dim ApptArray As %List
 #dim tSC,tSC1,tSC2 As %Status = $$$OK  #dim processingFlag As %String
 #dim patientFacility As %String
 #dim providerFacility As %String
 #dim pFlag,provFlag,patFlag AS %Numeric = 0
 
 
 pInput.Rewind()
 pJSON=pInput.Read()  set sc=##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(pJSON,"TMP.AppointmentReqMsg",.pRequestBody,1)
 s:##class(Ens.Util.FunctionSet).Lookup("CernerSites",pRequestBody.ProviderFacility)>0 provFlag=1
 S:##class(Ens.Util.FunctionSet).Lookup("CernerSites",pRequestBody.PatientFacility)>0 patFlag=1
     pFlag=provFlag+patFlag   ;pFlag=0;VistA only, pFlag=2;Cerner only, pFlag=1;Cerner and VistA
     pRequestBody.ProcessingFlag=(provFlag+patFlag)
 $$$LOGWARNING("checking json")
 s:##class(Ens.Util.FunctionSet).Lookup("CernerSites",pRequestBody.PatientResources.Facility)'>0 tSC2 = ..checkJSON(pRequestBody.PatientResources.Resources)
 $$$LOGWARNING("checking json returned "_tSC2)
 $p(tSC2,"^",1)=2 tSC=..ReturnJSONAckMsg(.pRequestBody,tSC2)
 q:$p(tSC2,"^",1)=2 200
 s:##class(Ens.Util.FunctionSet).Lookup("CernerSites",pRequestBody.ProviderResources.Facility)'>0 tSC2 = ..checkJSON(pRequestBody.ProviderResources.Resources)
 $$$LOGWARNING("checking json returned "_tSC2)
 $p(tSC2,"^",1)=2 tSC=..ReturnJSONAckMsg(.pRequestBody,tSC2)
 q:$p(tSC2,"^",1)=2 200
 
 badResponse=##class(AppointmentResponseMsg).%New()
 badResponse.ControlId = pRequestBody.ControlId
 badResponse.MessageId = pRequestBody.MessageId
 badResponse.OrganizationName = "CVT15"
 badResponse.Status="AA"
 badResponse.FailureReason=""
 if +$L(patientFacility)>0
 {
   VistABO=##class(Ens.Util.FunctionSet).Lookup("TMP_VistA_Systems",patientFacility),^zzphil("p1")=VistABO
   
 s:$g(VistABO)="" badResponse.FailureReason="Patient Site is not configured in HealthConnect"
 }
 
 
 
 if $L(providerFacility)>0
 {
  VistABO1=##class(Ens.Util.FunctionSet).Lookup("TMP_VistA_Systems",providerFacility)
  s:##class(Ens.Util.FunctionSet).Lookup("CernerSites",providerFacility)>0 provprocessingFlag="Cerner"
  s:$g(VistABO1)="" badResponse.FailureReason="Provider Site is not configured in HealthConnect"
 }
 
 
 if badResponse.FailureReason'="" 
 
    set tSC=..SendRequestSync("ProcessBadApptRequest",.badResponse,.pResponse) Quit:$$$ISERR(tSC)
 }
 
 else
 {
 
 if pFlag=0
 {
  tSC1 = ..SendRequestSync("ProcessVistAAppointments",.pRequestBody,.pResponse)
 }
 
 if pFlag=1
 {
  tSC1 = ..SendRequestSync("ProcessCernerAndVistAAppointments",.pRequestBody,.pResponse)
 }
 if pFlag=2
 {
  tSC1 = ..SendRequestSync("ProcessCernerOnlyAppointments",.pRequestBody,.pResponse)
 }  }  
 Quit tSC1
}

Thanks Vic, the problem is we are one of two teams updating the production. Fortunately, both teams are working in separate efforts and are not working in the same classes in the production. The work our team is doing is creating new business services, process and operations and message classes. but the deployment happens by another team so I am looking to create a simple deployment package they would run to add our new components to the production. I am trying not to have to write a step by step deployment guide that tells them to create this business service with this class, this business process with this bpl, etc.

Thanks Vic and Ben. it looks like what you and Ben Spead are saying is to build a new project that contains just my code to be deployed and then use the Ens.Deployment.Utils class to deploy that project. But does it set up the business operations, services and processes in the production so that they don't have to be set up and configured manually to use the classes? Trying to make it as simple and automated as possible.