vb.net - The remote server returned an error: (400) Bad Request. while connecting to QB online through qbxml -
my connection qb online working fine. works add customers qb online. when passing checks through gives bad request error.
below qbxml.
string post = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <?qbxml version=""10.0""?> <qbxml> <signonmsgsrq> <signondesktoprq> <clientdatetime>%%client_date_time%%</clientdatetime> <applicationlogin>%%applogin%%</applicationlogin> <connectionticket>%%connticket%%</connectionticket> <language>english</language> <appid>%%appid%%</appid> <appver>1</appver> </signondesktoprq> </signonmsgsrq> <qbxmlmsgsrq onerror=""continueonerror""> <checkaddrq> <checkadd> <accountref> <listid>1</listid> <fullname>chase checking</fullname> </accountref> <payeeentityref> <listid>idtype</listid> <fullname>test vendor</fullname> </payeeentityref> <refnumber>11</refnumber> <txndate>05/06/2012</txndate> <memo>my first memo</memo> <address> <addr1>ahmedabad</addr1> <addr2>ahmedabad</addr2> <addr3>ahmedabad</addr3> <addr4>ahmedabad</addr4> <addr5>ahmedabad</addr5> <city>ahmedabad</city> <state>gujarat</state> <postalcode>360015</postalcode> <country>india</country> <note>note</note> </address> <istobeprinted>n</istobeprinted> <exchangerate></exchangerate> <externalguid></externalguid> <applychecktotxnadd> <txnid>9054</txnid> <amount>1000</amount> </applychecktotxnadd> <expenselineadd> <accountref> <listid></listid> <fullname>publisherpayment</fullname> </accountref> <amount>100</amount> <memo>memo</memo> </expenselineadd> </checkadd> <includeretelement>strtype</includeretelement> </checkaddrq> </qbxmlmsgsrq> </qbxml>"; can guide, please ?
as qbxml version needs 6.0 (even though idn unified on-screen reference shows 7.0) needed include onerror="continueonerror" attribute. setting webrequestobject.contentlength property required. content type needs "application/x-qbxml" , received many "the remote server returned error: (400) bad request." exceptions not helpful @ in end able trace them wrong xml. if exception xml source of problem. so, changed xml below.
string post = @"<?xml version=""1.0"" encoding=""utf-8""?> <?qbxml version=""6.0""?> <qbxml> <signonmsgsrq> <signondesktoprq> <clientdatetime>%%client_date_time%%</clientdatetime> <applicationlogin>%%applogin%%</applicationlogin> <connectionticket>%%connticket%%</connectionticket> <language>english</language> <appid>%%appid%%</appid> <appver>1</appver> </signondesktoprq> </signonmsgsrq> <qbxmlmsgsrq onerror=""stoponerror""> <checkaddrq requestid=""1""> <checkadd> <accountref> <fullname>checking</fullname> </accountref> <payeeentityref> <fullname>departures magazine</fullname> </payeeentityref> <refnumber>9999</refnumber> <txndate>2012-06-06</txndate> <memo>injury claims payment</memo> <address> <addr1>eli manning</addr1> <addr2>1234 s. giant st</addr2> <city>new york</city> <state>ny</state> <postalcode>40961</postalcode> </address> <istobeprinted>false</istobeprinted> <expenselineadd> <accountref> <fullname>publisher payment</fullname> </accountref> <amount>200.00</amount> </expenselineadd> </checkadd> </checkaddrq> </qbxmlmsgsrq> </qbxml>";
Comments
Post a Comment