0

我与在线 QB 的连接工作正常。它也适用于在线将客户添加到 QB。当我通过检查时,它会给出错误的请求错误。

下面是我的 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>";

有人可以指导吗?

4

1 回答 1

0
As the qbxml version needs to be 6.0 (even though the IDN Unified On-Screen Reference shows 7.0)
I needed to include the onError="continueOnError" attribute.
Setting the WebRequestObject.ContentLength property is required.
Content Type needs to be "application/x-qbxml"
And finally I received many "The remote server returned an error: (400) Bad Request." exceptions which were not helpful at all but in the end I was able to trace them to something wrong with the xml. So if you get this exception look to your xml as the source of the problem.

所以,最后我改变了我的xml如下。

    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>";
于 2012-06-06T10:55:40.957 回答