VBScriptSend XML Data to a Web Service
I use this from within a CAD application to send XML data to an Amazon Web Services APIGateway which, calls a Lambda microservice written in C# to serialize the XML into a data structure and then write the information to a database.
The input is the raw XML string, and the output is the response from the API Gateway and Lambda function.
Sub main(iXML As String , oResponse As String)
Dim result As String
Dim myURL As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
myURL = "https://abcdef01223334.execute-api.eu-west-1.amazonaws.com/Prod"
myURL = myURL & "/v1/ImportXML"
With winHttpReq
.Open "POST", myURL, False
.setRequestHeader "Content-Type", "application/xml"
.setRequestHeader "X-API-Key", "123456abcd789456wetjgvs65w1ef65w1se1fw"
.Send( iXML )
.waitForResponse 4000
result = .responseText
End With
oResponse.Value = result
End Sub