How to pass SOAP response back to Sender
I have an XML I am sending to an operation from a BPL. This is a query for Patient information from Epic using a web service. I created the operation using the add-in in Studio. I setup the BPL to do a Call and send whatever data I receive from the client. I get a response back from Epic with a list of matching Patients. In the BPL I am trying to use the Response Builder to pass the response ID, name, DOB, etc. to matching context items to then pass to the client as a response. I get the following error within the call:
ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zOnResponse1+2 ^FCH.BPL.PATWISJSONEPICXML.Context.1 *IDs,%Collection.ListOfObj -- logged as '-' number - @''
From what I can tell the IDs is in the definition but because the response can be multiple responses that I need to handle it. I am stuck on how I need to setup the context items and/or how to read the response when there is the possibility of multiple responses.
Class FCH.Response.PatientLookupResponse Extends Ens.Response [ ProcedureBlock ] { Property PatientLookupResult As Patient.Patient.PatientLookupResponse; }
/// Created from: http://fchepicgenict01.fm.frd.fmlh.edu/Interconnect-FCHEDIPOC/wcf/Epic.EMPI.GeneratedServices/Patient.svc?wsdl=wsdl0 Class Patient.Patient.PatientLookupResponse Extends (%SerialObject, %XML.Adaptor) [ ProcedureBlock ] { Parameter ELEMENTQUALIFIED = 1; Parameter NAMESPACE = "urn:Epic-com:EMPI.2012.Services.Patient"; Parameter XMLNAME = "Patient.PatientLookupResponse"; Parameter XMLSEQUENCE = 1; Parameter XMLTYPE = "Patient.PatientLookupResponse"; Property Patients As list Of Patient.Patient(XMLITEMNAME = "Patient", XMLNAME = "Patients", XMLPROJECTION = "COLLECTION"); }
/// Created from: http://fchepicgenict01.fm.frd.fmlh.edu/Interconnect-FCHEDIPOC/wcf/Epic.EMPI.GeneratedServices/Patient.svc?wsdl=wsdl0 Class Patient.Patient Extends (%SerialObject, %XML.Adaptor) [ ProcedureBlock ] { Parameter ELEMENTQUALIFIED = 1; Parameter NAMESPACE = "urn:Epic-com:EMPI.2012.Services.Patient"; Parameter XMLNAME = "Patient"; Parameter XMLSEQUENCE = 1; Property Addresses As list Of Patient.Address(XMLITEMNAME = "Address", XMLNAME = "Addresses", XMLPROJECTION = "COLLECTION"); Property Aliases As Patient.q1.ArrayOfstring(XMLNAME = "Aliases"); Property CareTeam As list Of Patient.CareTeamMember(XMLITEMNAME = "CareTeamMember", XMLNAME = "CareTeam", XMLPROJECTION = "COLLECTION"); Property ConfidentialName As %String(MAXLEN = "", XMLNAME = "ConfidentialName"); Property DateOfBirth As %String(MAXLEN = "", XMLNAME = "DateOfBirth"); Property EmergencyContacts As list Of Patient.EmergencyContact(XMLITEMNAME = "EmergencyContact", XMLNAME = "EmergencyContacts", XMLPROJECTION = "COLLECTION"); Property EmploymentInformation As Patient.EmploymentInformation(XMLNAME = "EmploymentInformation"); Property EthnicGroup As %String(MAXLEN = "", XMLNAME = "EthnicGroup"); Property HistoricalIDs As list Of Patient.IDType(XMLITEMNAME = "IDType", XMLNAME = "HistoricalIDs", XMLPROJECTION = "COLLECTION"); Property HomeDeployment As %String(MAXLEN = "", XMLNAME = "HomeDeployment"); Property IDs As list Of Patient.IDType(XMLITEMNAME = "IDType", XMLNAME = "IDs", XMLPROJECTION = "COLLECTION"); Property MaritalStatus As %String(MAXLEN = "", XMLNAME = "MaritalStatus"); Property Name As %String(MAXLEN = "", XMLNAME = "Name"); Property NameComponents As Patient.NameComponents(XMLNAME = "NameComponents"); Property NationalIdentifier As %String(MAXLEN = "", XMLNAME = "NationalIdentifier"); Property Race As Patient.q1.ArrayOfstring(XMLNAME = "Race"); Property Rank As %String(MAXLEN = "", XMLNAME = "Rank"); Property Sex As %String(MAXLEN = "", XMLNAME = "Sex"); Property Status As %String(MAXLEN = "", XMLNAME = "Status"); }
Thank you for your time
Can you also post OnResponse1 method of FCH.BPL.PATWISJSONEPICXML.Context class?
Method OnResponse1(process As Ens.BusinessProcess, context As Ens.BP.Context, request As EnsLib.REST.GenericMessage, response As EnsLib.REST.GenericMessage, callrequest As FCH.Request.PatientLookupRequest, callresponse As FCH.Response.PatientLookupResponse, callname As %String) As %Status [ Language = cache, PublicList = (process, context) ]
{
Set $ZT="Trap",status=$$$OK do {
Set status=context.ReturnedIds.SetAt(callresponse.PatientLookupResult.Patients.IDs.ID,1)
If $$$ISERR(status) Quit
} while (0)
Exit Quit status
Trap Set $ZT="",status=##class(Ens.Util.Error).EnsSystemError("FCH.BPL.PATWISJSONEPICXML.Thread1","OnResponse1")
Goto Exit
}
Second line should be:
You need to modify your BP definition to something like this:
To copy all IDs for all patients you'll need to iterate over results.
That worked
<response type='FCH.Response.PatientLookupResponse' >
<assign property="context.ReturnedIds" value="callresponse.PatientLookupResult.Patients.GetAt(1).IDs.GetAt(1).ID" action="set" key="1" />
</response>
Now I have to work on the response with multiple Patients.