go to post Michael Wood · Nov 29, 2023 does the same apply for if it is an array? The first character is a [ [ { "RequestedTerm":{ "CatalogIdentifier":"S_ASC_CARE_BRANCH", "TermSourceCode":"ASC-BRC-000179", "IncludeDomainCharacteristics":true }, "Messages":[ . . . . ]
go to post Michael Wood · Nov 29, 2023 I tried this, I set pResponse As %String for the method output set pResponse=""set formatter = ##class(%JSON.Formatter).%New()set tJSONFormattedString=""set tSC = formatter.FormatToString(tHttpResponse.Data.Read(),.tJSONFormattedString)set pResponse = tJSONFormattedStringquit pResponse It produces this error ERROR <Ens>ErrGeneral: Quitting with error on Message body 6@AH.AHLIB.Custom.Symedical.Message.PostRelationRequest / 1201174076 because Status 'ERROR #5034: Invalid status code structure ("["_$c(13,10)_" {"_$c(13,10)_" ""RequestedTerm"":{"_$c(13,10)_" ""CatalogIdentifier"":""S_ASC_CARE_BRANCH"","_$c(13,10)_" ""TermSourceCode"":""ASC-BRC-000179"","_$c(13,10)_" ""IncludeDomainCharacteristics"":true"_$c(13,10)_" },"_$c(13,10)_" ""Messages"":["_$c(13,10)_" ],"_$c(13,10)_" ""RelatedItems"":["_$c(13,10)_" {"_$c(13,10)_" ""RelationshipUID"":""1146f07d-9c93-4c4e-82ba-0989fa6a62d9"","_$c(13,10)_" ""RelationshipMnemonic"":""HAS_SITECORE_ID"","_$c(13,10)_" ""CatalogU.....
go to post Michael Wood · Nov 28, 2023 Response is an array so my respose class is defined as, Property Response As list Of AH.AHLIB.Custom.Symedical.Message.PostRelationResponse.response; class AH.AHLIB.Custom.Symedical.Message.PostRelationResponse.response is defined as, Parameter %JSONIGNOREINVALIDFIELD = 1; Property RequestedTerm As AH.AHLIB.Custom.Symedical.Message.PostRelationRequest.termsRequested; Property Messages As %Library.DynamicArray; Property RelatedItems As %Library.DynamicArray; Property SharedRelations As %Library.DynamicArray; Last three properties are arrays, but I don't need their contents. Do I define them right?
go to post Michael Wood · Nov 28, 2023 ERROR <Ens>ErrGeneral: Retrying Message body 6@AH.AHLIB.Custom.Symedical.Message.PostRelationRequest / 1200944442 because response 8@AH.AHLIB.Custom.Symedical.Message.PostRelationResponse Status 'ERROR #9406: Unexpected format for value of field, Response, using class base mapping' matched ReplyCodeAction 1 : 'E=RF' resulting in Action code RF
go to post Michael Wood · Jul 19, 2023 That worked. Thanks. ClassMethod GetObjectFieldValue(pObject As %String, pField As %String) As %String{ quit:pObject="" "" quit:pField="" "" $$$TRACE("pObject="_pObject) $$$TRACE("pField="_pField) set dynObj=##Class(%DynamicAbstractObject).%FromJSON(pObject) set tValue=$PROPERTY(dynObj,pField) return tValue }