用于发布到 QuickBooks Online Edition 的有效 XML - 接收 (400) 错误请求错误

发布于 2024-07-27 22:34:46 字数 1399 浏览 8 评论 0原文

我正在尝试将以下 xml 发布到 https://apps.quickbooks.com/j/AppGateway 我一直收到的只是错误:远程服务器返回错误:(400) 错误请求。 有人知道我做错了什么吗? 请参阅下面我用来发布 xml 的 C# 代码。

谢谢, -Jeff

更新:为了向我的问题添加更多内容,我认为 (400) Bad Request 错误表明我的 xml 或我发布 xml 的方式存在严重错误。 所以这就是我问这个问题的原因......我在这里错过了什么?

<?xml version="1.0" encoding="utf-8" ?>
<?qbxml version="7.0"?>
<QBXML>
<SignonMsgsRq>
<SignonDesktopRq>
<ClientDateTime>7/20/2009 12:36PM</ClientDateTime>
<ApplicationLogin>APP_LOGIN</ApplicationLogin>
<ConnectionTicket>CONNECTION_TICKET</ConnectionTicket>
<Language>English</Language>
<AppID>APP_ID</AppID>
<AppVer>1</AppVer>
</SignonDesktopRq>
</SignonMsgsRq>
<QBXMLMsgsRq>
<CustomerQueryRq requestID="2" />
</QBXMLMsgsRq>
</QBXML>



WebRequestObject = (HttpWebRequest)WebRequest.Create(requestUrl);
WebRequestObject.Method = "POST";
WebRequestObject.ContentType = "application/x-qbxml";
WebRequestObject.AllowAutoRedirect = false;
string post = XmlText.Text;

WebRequestObject.ContentLength = post.Length;

swr = new StreamWriter(WebRequestObject.GetRequestStream());
swr.Write(post);
swr.Close();

WebResponseObject = (HttpWebResponse)WebRequestObject.GetResponse();

I am trying to post the below xml to https://apps.quickbooks.com/j/AppGateway and all I keep getting is the error: The remote server returned an error: (400) Bad Request. Does anyone have any ideas what I am doing wrong? See below for the C# code that I am using to post the xml.

Thanks,
-Jeff

UPDATE: To add more to my question, I am thinking that the (400) Bad Request error is indicating that I have something grossly wrong with the xml or with the way I am posting the xml. So that is why I am asking this question... what am I missing here?

<?xml version="1.0" encoding="utf-8" ?>
<?qbxml version="7.0"?>
<QBXML>
<SignonMsgsRq>
<SignonDesktopRq>
<ClientDateTime>7/20/2009 12:36PM</ClientDateTime>
<ApplicationLogin>APP_LOGIN</ApplicationLogin>
<ConnectionTicket>CONNECTION_TICKET</ConnectionTicket>
<Language>English</Language>
<AppID>APP_ID</AppID>
<AppVer>1</AppVer>
</SignonDesktopRq>
</SignonMsgsRq>
<QBXMLMsgsRq>
<CustomerQueryRq requestID="2" />
</QBXMLMsgsRq>
</QBXML>



WebRequestObject = (HttpWebRequest)WebRequest.Create(requestUrl);
WebRequestObject.Method = "POST";
WebRequestObject.ContentType = "application/x-qbxml";
WebRequestObject.AllowAutoRedirect = false;
string post = XmlText.Text;

WebRequestObject.ContentLength = post.Length;

swr = new StreamWriter(WebRequestObject.GetRequestStream());
swr.Write(post);
swr.Close();

WebResponseObject = (HttpWebResponse)WebRequestObject.GetResponse();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鲸落 2024-08-03 22:34:46

将您的 qbXML 版本更改为 6.0,QuickBooks Online Edition 尚不支持 7.0。

Change your qbXML version to 6.0, QuickBooks Online Edition doesn't support 7.0 yet.

埋葬我深情 2024-08-03 22:34:46

请求中发布的xml在哪里? 或者您缺少在此处粘贴一些代码。 我在上面的代码中没有看到请求有 XML。 该请求是错误的,因为该请求不包含 XML。 至少从我上面看到的

where is the xml posted in request?? Or you are missing to paste some code here. I don't see the request has XML in the above code. The request is bad because the request contain no XML. At least from what I see above

烛影斜 2024-08-03 22:34:46

正如 基思·帕尔默 在他的回答中提到版本号需要为6.0,但还需要包含 onError 属性QBXMLMsgsRq 标签。 (我还按照 Keith Palmer 的建议更正了时间格式。)

完整/工作 xml 在这里:

<?xml version="1.0" encoding="utf-8" ?> 
<?qbxml version="6.0"?> 
<QBXML> 
    <SignonMsgsRq>
        <SignonDesktopRq> 
            <ClientDateTime>2009-07-21T10:10:00</ClientDateTime> 
            <ApplicationLogin>APPLICATION_LOGIN</ApplicationLogin>
            <ConnectionTicket>CONNECTION_TICKET</ConnectionTicket>
            <Language>English</Language> 
            <AppID>APP_ID</AppID>
            <AppVer>1</AppVer> 
        </SignonDesktopRq> 
    </SignonMsgsRq> 
    <QBXMLMsgsRq onError="continueOnError"> 
        <CustomerQueryRq requestID="2" /> 
    </QBXMLMsgsRq> 
</QBXML>

As Keith Palmer mentioned in his answer the version number needs to be 6.0 but also need to include the onError attribute of the QBXMLMsgsRq tag. (I also corrected the time format too as recommend by Keith Palmer.)

Complete/working xml is here:

<?xml version="1.0" encoding="utf-8" ?> 
<?qbxml version="6.0"?> 
<QBXML> 
    <SignonMsgsRq>
        <SignonDesktopRq> 
            <ClientDateTime>2009-07-21T10:10:00</ClientDateTime> 
            <ApplicationLogin>APPLICATION_LOGIN</ApplicationLogin>
            <ConnectionTicket>CONNECTION_TICKET</ConnectionTicket>
            <Language>English</Language> 
            <AppID>APP_ID</AppID>
            <AppVer>1</AppVer> 
        </SignonDesktopRq> 
    </SignonMsgsRq> 
    <QBXMLMsgsRq onError="continueOnError"> 
        <CustomerQueryRq requestID="2" /> 
    </QBXMLMsgsRq> 
</QBXML>
极度宠爱 2024-08-03 22:34:46

您可以在此站点获取客户查询的 XML:

QuickBooks Online OSR< /a>

选择 CustomerQuery 作为消息。 使用 Chrome,因为它并不适用于所有浏览器。 单击 XmlOps,您将看到 XML。

另一方面,我在这里提供了一个商业解决方案:

QuickBooks Online C# Development Integration

You can get the XML for a customer query at this site:

QuickBooks Online OSR

Select CustomerQuery as the message. Use Chrome because it doesn't work in all browsers. Click XmlOps and you'll see the XML.

On another note, I have a commercial solution available here:

QuickBooks Online C# Development Integration

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文