Trying to send information from %CSP.REST extended class to a Business Process
I've got a REST service that I can access via a browser. I can get it to take HTML tags as data and display it back to me (so I know the REST part is working). So if I send it this:
http://MyServer:57772/TestArea/rest/TestQuery?UUID=1&RTX=RTX123456&CareType=Palliative
Then I can pick out the data and tell it to display in the browser, which is great but what I really want to do is put the data into a string and send to a business process that will do lots of looking up but eventually return a URL that my REST service will then redirect the browser to.
Been trying to follow advice from here but something isn't working as all I get is ERROR #5002.
/// TestArea's Dispatch class for all REST Services Class REST.Dispatch Extends %CSP.REST { XData UrlMap [ XMLNamespace = "http://www.TestArea.com/urlmap" ] { <Routes> <Route Url="/TestQuery" Method="GET" Call="TestQueryString" /> </Routes> } ClassMethod TestQueryString() As %Status { Set tSC = $$$OK if 'tSC Quit tSC Set tProxy = ##class(%ZEN.proxyObject).%New() Set tProxy.UUID = $Get(%request.Data("UUID",1)) Set tProxy.RTX = $Get(%request.Data("RTX",1)) Set tProxy.CareType = $Get(%request.Data("CareType",1)) Set tTextOut = ##class(Ens.StringContainer).%New() Set tTextOut = tProxy.UUID_"|"_tProxy.RTX_"|"_tProxy.CareType // Need to create a temporary Service to use to call and get the response from // our Business Process. Set tSC = ##class(Ens.Director).CreateBusinessService("Strata JSON Service",.tService) Set message = ##class(Ens.StringContainer).%New(tTextOut) Set targetName = "StrataJSON2URLBP" Set response1 = ##class(Ens.StringContainer).%New() Set timeout = -1 Set description = "Strata URL" Set tSC = tService.SendRequestSync(targetName, message, .response1, timeout, description) Set %response.redirect = response1 Quit $$$OK } }
The Business Process StrataJSON2URLBP exists but is fairly sparse at the moment so I suppose the error could also be in there. Let me know if you want that posting.
The error response if that helps:
{
"errors":[ {
"code":5002,
"domain":"%ObjectErrors",
"error":"ERROR #5002: Cache error: <INVALID OREF>zTestQueryString+28^REST.Dispatch.1",
"id":"CacheError",
"params":["<INVALID OREF>zTestQueryString+28^REST.Dispatch.1"
]
}
],
"summary":"ERROR #5002: Cache error: <INVALID OREF>zTestQueryString+28^REST.Dispatch.1"
}