Page 1 of 1

Help converting VB to FWH

Posted: Thu Jul 19, 2007 7:49 pm
by cdmmaui
Hello,

Can anyone help me convert the following VB code to FWH? I would appreciate the help.


Dim qbXMLRP As New QBXMLRP2Lib.RequestProcessor2

Dim ticket As String

qbXMLRP.OpenConnection cAppID, cAppName

ticket = qbXMLRP.BeginSession("", QBXMLRP2Lib.qbFileOpenDoNotCare)

Dim builder As New DOMDocument40

Dim QBXML As IXMLDOMNode
Set QBXML = builder.createElement("QBXML")
builder.appendChild QBXML
Dim msgsRq As IXMLDOMElement
Set msgsRq = QBXML.appendChild(builder.createElement("QBXMLMsgsRq"))

msgsRq.setAttribute "onError", "continueOnError"
Dim CustomerAddRq As IXMLDOMElement
Dim CustomerAdd As IXMLDOMElement
Set CustomerAddRq = msgsRq.appendChild(builder.createElement("CustomerAddRq"))

Set CustomerAdd = CustomerAddRq.appendChild(builder.createElement("CustomerAdd"))

Dim dataElement As IXMLDOMElement

Set dataElement = CustomerAdd.appendChild(builder.createElement("Name"))
dataElement.appendChild builder.createTextNode(custName)

Dim supportedVersion As String

supportedVersion = qbXMLLatestVersion(qbXMLRP, ticket)

requestXML = qbXMLAddProlog(supportedVersion, builder.xml)

responseXML = qbXMLRP.ProcessRequest(ticket, requestXML)


qbXMLRP.EndSession ticket

qbXMLRP.CloseConnection

Posted: Tue Jul 24, 2007 5:58 pm
by Antonio Linares
qbXMLRP = CreateObject( "QBXMLRP2Lib.RequestProcessor2" )

qbXMLRP:OpenConnection( cAppID, cAppName )

ticket = qbXMLRP:BeginSession( "", CreateObject( "QBXMLRP2Lib.qbFileOpenDoNotCare" ) ) // Not sure about this. Maybe QBXMLRP2Lib.qbFileOpenDoNotCare its a constant value

builder = CreateObject( "DOMDocument40" )
QBXML = builder:createElement( "QBXML" )
builder:appendChild( QBXML )
msgsRq = QBXM:.appendChild( builder:CreateElement("QBXMLMsgsRq"))

msgsRq:setAttribute( "onError", "continueOnError" )
CustomerAddRq = msgsRq:appendChild(builder:createElement("CustomerAddRq"))

CustomerAdd = CustomerAddRq:appendChild(builder:createElement("CustomerAdd"))

dataElement = CustomerAdd:appendChild(builder:createElement("Name"))
dataElement:appendChild( builder:createTextNode(custName) )

supportedVersion = qbXMLLatestVersion(qbXMLRP, ticket)

requestXML = qbXMLAddProlog(supportedVersion, builder:xml)

responseXML = qbXMLRP:ProcessRequest(ticket, requestXML)


qbXMLRP:EndSession( ticket )

qbXMLRP:CloseConnection()