eFORMz API: POST of XML data to an Accessible Queue
For a comprehensive resource, consult the following: eFORMz API Management (Developer Resources) [Web Services]
eFORMz can be called as a web service. We loosely refer to eFORMz calling itself as the eFORMz API (Application Programming Interface). For more details, view the following posts:
eFORMz API (Called as a Web Service)
eFORMz API .NET Web Service Call
VBScript sample: POST of XML data to an Accessible Queue
Below, there’s a standalone VBScript example of calling eFORMz API, specifically the POST of XML data to an Accessible Queue. This example includes the creation of the XML data using objects in place of the problematic strings.Replacing the text1 line with:
set text1 = xdoc.createTextNode("TITLE & stuff")
Yields the following XML data:
TITLE & stuffNAME
Example
option explicit
'On Error Resume Next
Function CallWebService(URL, ConfigurationName, QueueName, NameTemplate, strRequest)
dim strUrl
dim http
dim Cfg
dim Queue
dim Name
Cfg = "&ConfigurationName=" & ConfigurationName Queue = "&QueueName=" + QueueName Name = "&NameTemplate=" + NameTemplate Const EFZAPI = "/servlet/com.minisoft.AppServer.AppServer?APP=com.minisoft.eformz.eFORMzApp" Const DIRECTOR = "&director&Host=localhost&Port=9996&User=minisoft&Password=password" Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056 strUrl = URL + EFZAPI + DIRECTOR + Cfg + Queue + Name set http=CreateObject("MSXML2.ServerXMLHTTP.3.0") http.SetOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS http.open "POST",strUrl,false http.setRequestHeader "Content-Type","text/xml" http.send strRequest If http.Status = 200 Then 'WScript.Echo "STATUS : " & http.status 'WScript.Echo "RESPONSE : " & http.responseText else WScript.Echo "STATUS : " & http.status WScript.Echo "RESPONSE : " & http.responseText End If
End Function
Function CreateXML()
dim xdoc
dim root
dim title
dim name
dim text1
dim text2
set xdoc = CreateObject("MSXML2.DOMDocument") set root = xdoc.appendChild(xdoc.CreateElement("data")) set title = root.appendChild(xdoc.createElement("title")) set text1 = xdoc.createTextNode("TITLE") title.appendChild text1 set name = root.appendChild(xdoc.createElement("name")) set text2 = xdoc.createTextNode("NAME") name.appendChild text2 CreateXML = xdoc.xml
End Function
dim URL
dim ConfigurationName
dim QueueName
dim NameTemplate
dim strRequest
URL = "https://localhost:8000"
ConfigurationName = "accessible.cfg"
QueueName = "Accessible"
NameTemplate = "data.xml"
strRequest = CreateXML()
CallWebService URL, ConfigurationName, QueueName, NameTemplate, strRequest
