QuickBooks Merchant Services with Visual Basic .NET

Protected Function getSession(ByVal Site As String)
        Dim req As WebRequest = WebRequest.Create(Site)
        Dim xmldom As New XmlDocument
        Dim request_xml As String
        Dim myWriter As StreamWriter

        xmldom.Load("~\XML\GetSessionTicket.xml")
        request_xml = xmldom.InnerXml

        req.Method = "POST"
        req.ContentLength = request_xml.Length
        req.ContentType = "application/x-qbmsxml"

        myWriter = New StreamWriter(req.GetRequestStream)
        myWriter.Write(request_xml)
        myWriter.Close()

        Dim resp As WebResponse = req.GetResponse()

        Dim s As Stream = resp.GetResponseStream()
        Dim sr As StreamReader = New StreamReader(s, Encoding.ASCII)
        Dim doc As String = sr.ReadToEnd()

        Return doc

    End Function 
quickbooks_qbms_integration_vbdotnet.txt · Last modified: 2013/01/21 12:44 (external edit)