We sent the EnsLib.HTTP.GenericService into a process that did this, hope it helps.

Include Ensemble

Class Component.httpResendMessage Extends Ens.BusinessProcess
{

Method OnRequest(pRequest As EnsLib.HTTP.GenericMessage, Output pResponse As EnsLib.HTTP.GenericMessage) As %Status
{     

    set tSC=$$$OK
    namespace = $REPLACE(pRequest.HTTPHeaders.GetAt("IParams_1"),"namespace=","")
    ClientDocGUID= $REPLACE(pRequest.HTTPHeaders.GetAt("IParams_2"),"ClientDocGUID=","")
   

   s pResponse=##class(EnsLib.HTTP.GenericMessage).%New()
   set pResponseBody=##Class(%Stream.GlobalCharacter).%New()
   d pResponseBody.Write("<HTML><HEAD>Uh oh.</HEAD><BODY><BR><STRONG>Error: Invalid Patient ID</STRONG></BODY></HTML>")
   do pResponseBody.Rewind()
   d pResponse.HTTPHeaders.SetAt("HTTP/1.1 400 Bad Request","StatusLine")
   d pResponse.HTTPHeaders.SetAt("text/html; charset=utf-8","Content-Type")
   do pResponse.StreamSet(pResponseBody)
quit tSC
}  

}

You could also try adding a code section to you DTL, similar to this.

//this part collates the info to set the doctype
 set version=target.GetValueAt("MSH:VersionID.versionID")
 set type=target.GetValueAt("MSH:MessageType.messagetype")
 set trigger=target.GetValueAt("MSH:MessageType.triggerevent")
 //set trigger="A05"
 if ((trigger = "A08")!(trigger = "A11")!(trigger = "A27")!(trigger = "A03")!(trigger = "A12")!(trigger = "A13")){SET trigger = "A01"}
 //this sets the doctype
 set target.DocType=version_":"_type_"_"_trigger
 //set target.DocType="2.4:ADT_A05"