How to "Post" a URL based on the Alert Message
I am trying to create a URL for Spoke Mobile to page users when our email system is down and we can't use the normal email alerts.
I was directed to http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EHTTP_outbound and tried to create something. The best I got was a response from the webpage that told me there was an error.
I want to be able to have a default pager number when we don't have an oncall schedule and grab information from Ens.AlertMessage.
I thought this would work:
Class User.NewClass21 Extends Ens.BusinessOperation
{
Parameter ADAPTER = "EnsLib.HTTP.OutboundAdapter";
Property Adapter As EnsLib.HTTP.OutboundAdapter;
Parameter INVOCATION = "Queue";
/// Analyst Pager number
Property PIN As %String;
Parameter SETTINGS As %String = "PIN";
/// Alert Message
Property MSSG As %String;
Method OnD03Alert(pReq As User.Alert, Output pResp As %String) As %Status
{
Set httprequest = ##class(%Net.HttpRequest).%New()
Do httprequest.SetParam("PIN",..PIN)
Do httprequest.SetParam("MSSG","motogplay")
Do httprequest.Post(,1,0)
set stream = httprequest.HttpResponse.Data
while 'stream.AtEnd {
Set pResp = stream.Read($$$MaxStringLength)
}
Quit $$$OK
}
XData MessageMap
{
<MapItems>
<MapItem MessageType="User.Alert">
<Method>OnD03Alert</Method>
</MapItem>
</MapItems>
}
}
put get an error the my function needs to return a response.
here is the URL I am trying to get to http://www.usamobility.net/cgi-bin/wwwpage.exe?PIN=nnnnnnnnnn&MSSG=motoplay where nnnnnnnnnn is the pager number
Thanks for your time.
So from a network capture if I use out of the box operation EnsLib.http.operation the URL is correct
Here is the response from the trace:
Compiling class User.NewClass21
ERROR #5373: Class 'Ens.StreamResponse', used by 'User.NewClass21:OnD03Alert:FormalSpec', does not exist
> ERROR #5030: An error occurred while compiling class 'User.NewClass21'
Dropping orphaned procedure: SQLUSER.NEWCLASS21_ENUMERATESETTINGS
Detected 1 errors during compilation in 0.657s.
I am using HealthShare Health Connect 2018.1
Also here is the User.Alert
Class User.Alert Extends Ens.Request
{
/// Analyst Pager number
Property PIN As %String;
/// Alert Message
Property MSSG As %String;
Storage Default
{
<Data name="AlertDefaultData">
<Subscript>"Alert"</Subscript>
<Value name="1">
<Value>PIN</Value>
</Value>
<Value name="2">
<Value>MSSG</Value>
</Value>
</Data>
<DefaultData>AlertDefaultData</DefaultData>
<Type>%Library.CacheStorage</Type>
}
}
You need to specify where you want to send your request. Something like this should work.
Also Ensemble operations must return persistent objects so I replaced string with Ens.StreamResponse.
Sorry, I meant Ens.StreamContainer class.
Updated snippet code.