用于发布到 QuickBooks Online Edition 的有效 XML - 接收 (400) 错误请求错误
我正在尝试将以下 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将您的 qbXML 版本更改为 6.0,QuickBooks Online Edition 尚不支持 7.0。
Change your qbXML version to 6.0, QuickBooks Online Edition doesn't support 7.0 yet.
请求中发布的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
正如 基思·帕尔默 在他的回答中提到版本号需要为6.0,但还需要包含 onError 属性QBXMLMsgsRq 标签。 (我还按照 Keith Palmer 的建议更正了时间格式。)
完整/工作 xml 在这里:
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:
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