Here are a few code samples that could help : 


Class YourPackage.REST.CSoapAuthenticator Extends %CSP.REST

Parameter CONTENTTYPE = "text/xml";
XData UrlMap [ XMLNamespace = "" ]
<Route Url="/:soapService" Method="POST" Call="PostSOAP"/>

ClassMethod PostSOAP(
    strSoapService As %String = "",
    test As %Integer = 0) As %Status
   #Dim %request As %CSP.Request
   #Dim %response As %CSP.Response
   #Dim httpClient As %Net.HttpRequest = ..GetLoopbackSOAPClient()
   do httpClient.EntityBody.Write(..UpdateSoapBody(%request.Content.Read($$$MaxStringLength)))
   do httpClient.SetHeader("SOAPAction", %request.SoapAction)
   do httpClient.Post($System.CSP.GetDefaultApp($Namespace) _ "/" _ strSoapService, test)

   set %response.ContentType = "text/xml"
   write httpClient.HttpResponse.Data.Read($$$MaxStringLength)

   return $$$OK

// -- Private utils --
ClassMethod GetLoopbackSOAPClient() As %Net.HttpRequest [ Private ]
   set httpClient = ##class(%Net.HttpRequest).%New()
   set httpClient.Server = ...
   set httpClient.Port = ...
   set httpClient.Timeout = 5
   set httpClient.Https = 1
   set httpClient.SSLConfiguration = ...
   return httpClient

ClassMethod UpdateSoapBody(strInput As %String) As %String [ Private ]
   #Dim strSoap As %String = ""
   #Dim username As %String = ... (Extract from Input)
   #Dim password As %String = ... (Extract from Input)
   set strSoap = strSoap _ ... (Copy soap enveloppe from input)
   set strSoap = strSoap _ " <soap:Header>" _ ..GenerateSecurityHeader(username, password) _ " </soap:Header>"
   set strSoap = strSoap _ " <soap:Body>"
   set strSoap = strSoap _ " </soap:Body>"
   set strSoap = strSoap _ "</soap:Envelope>"
   return strSoap

ClassMethod GenerateSecurityHeader(
    strUsername As %String,
    strPassword As %String) As %String [ Private ]
   set header = ##class(%SOAP.Security.Header).%New()
   set usernameToken = ##class(%SOAP.Security.UsernameToken).Create(strUsername, strPassword)
   do header.AddSecurityElement(usernameToken)

   return ... (Use XML Writer to Output header to a String.)


I ended-up creating a %CSP.Rest class that acts as a proxy which reordered the fields in order to generate a standard SOAP request with the proper headers. Works great for a minimum of code.

Yes the mocking framework is still under active development here. I'm sorry there are missing classes in the provided example. I'll completely forgot about my reply a year ago...  Yes testing business hosts works very well with it. I'll try to arrange something today and I'll reply here. If I don't, reply back ! 

Is is still recommended to separate the Globals and Routines ? What's the major benefit of it ? Rapid deployment by switching the Routine database ?

I would be very much interested in your findings. I already started something that is producing a CSV  file with a summary of a production. Perhaps this could be helpful to the community, contact me in private since I can't attach a file. This is not ment for Archi mate but perhaps you can be inspired by it. 

Sorry about that, I will commit them in the next few days or perhaps tonight. At the time they were not added to the repo because of dependencies but I'm sure I can arrange something. Plus I'll add the latest development we did at CIUSSSE-CHUS. I'm glad someone else uses it ! 

Kind regards,


I know this is an old post and I don't expect a reply but is there a way to enable SNI or are the headers added by default ?