How to set up a BO for XML
I'm cautious not to ask too many questions on here, but there really doesn't seem to be a good XML end to end guide that explains these things.
I have now a Business operation that's going to call a url like
I'm looking the status of the practice- I tried date but again fell flat as i wan't able to ensure i only got the end date from the first <date> tags and not any subsequent dates.
Managed to do it kinda in a class method like so
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) {do $System.Status.DisplayError(status)}
do reader.Correlate("Status","User.Writenode")
do reader.Next(.obj)
zw obj
(1) couldn't find anywhere as such to get the value from the property that was correlated against but anyway.
Trued to put into a Buinsess operation which I always got a blank response evne though running the class method would work. When i called the .Next() i would get a Class not defined error
Class Penn.EDT.BO.ODSGPCheck Extends (Ens.BusinessOperation, %XML.Adaptor)
{ 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) {do $System.Status.DisplayError(status)}
do reader.Correlate("Status",pResponse)
do reader.Next()
//set pResponse.Status=obj
quit status
} XData MessageMap
{
<MapItems>
<MapItem MessageType="Penn.EDT.Messages.GetGPStatusRequest">
<Method>GetGPStatus</Method>
</MapItem>
</MapItems>
} }
I just want to call a URL - get the response back of what that node says. Works as a class method but not a Buisness operation and can't see what suitable adapter would be required to stop it complaining.