The Main subroutine make the calls to create XML document and builds the XML request.
Below is a sample code to generate an XML document and send a HTTP Post request to the application server:
Public Sub Main() On Error GoTo ErrorHandle Dim doc As New MSXML2.DOMDocument30 Dim rNode As MSXML2.IXMLDOMElement Dim doc1 As MSXML2.DOMDocument30 Dim RespFile As String Dim ReqFile As String Dim Service As String 'Create the XML document Set doc = New MSXML2.DOMDocument30 If (createXMLDocument("AccessLicenseAgreementRequest", doc)) Then
' ******* Build an Access License Agreement Request ***************** 'Adding Nodes to the XML document that was previously created "doc" AddNode doc, "AccessLicenseAgreementRequest", "", "", "xml:lang", "en-US" AddNode doc, "AccessLicenseAgreementRequest", "Request", "EMPTY_NODE", "", "" AddNode doc, "AccessLicenseAgreementRequest", "AccessLicenseNumber", "8B505CD8A2612824", "", "" AddNode doc, "AccessLicenseAgreementRequest", "AccessLicenseProfile", "EMPTY_NODE", "", "" AddNode doc, "Request", "TransactionReference", "EMPTY_NODE", "", "" AddNode doc, "Request", "RequestAction", "AccessLicense", "", "" AddNode doc, "Request", "RequestOption", "AllTools", "", "" AddNode doc, "TransactionReference", "CustomerContext", "License Test", "", "" AddNode doc, "TransactionReference", "XpicVersion", "1.0", "", "" AddNode doc, "AccessLicenseProfile", "CountryCode", "US", "", "" AddNode doc, "AccessLicenseProfile", "LanguageCode", "EN", "", "" indata = InputBox("Enter the full path and filename of Request to be created." & vbCrLf & vbCrLf & _ "If the path is not valid no file will be created", "Request File") If Len(Trim(indata)) <> 0 Then ReqFile = indata doc.save (ReqFile) MsgBox "Finish, see " & ReqFile & " for the generated XML Request." Else MsgBox "No demo for you" End If End If Exit Sub ErrorHandle: MsgBox "Error running Sample Code" End Sub |
Here is the VB module that contains all the code examples found in this section.
Copyright � 2006 United Parcel Service of America, Inc.