无法使用NotificationApi从Google Checkout获取通知

时间:2011-10-12 07:17:27

标签: google-checkout

我正在尝试使用Notifications Api实施Google Checkout,因为我想获取并将订单信息存储在我自己的数据库中。 Google Checkout已实施,订单已下达且付款已完成,但我无法收到来自Google Checkout的通知。 我已尝试过Google Checkout的商家帐户中的所有设置 http://surinder.computing-studio.com/ 并完成上面文章中列出的代码,但仍无法获取通知。 我在Merchant帐户的集成控制台中遇到的错误是:

我们在http://www.techieticket.co.uk/Notifications.aspx尝试访问您的服务器时遇到错误 - 我们得到的错误是

Send failed with code: 500. Response body was: <html>  <head>  <title>Data at the root level is invalid. Line 1, position 1.</title>  <style>  body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style>  </head>  <body bgcolor="white">  <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>  <h2> <i>Data at the root level is invalid. Line 1, position 1.</i> </h2></span>  <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">  <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br><br>  <b> Exception Details: </b>System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.<br><br>  <b>Source Error:</b> <br><br>  <table width=100% bgcolor="#ffffcc">  <tr>  <td>  <code><pre> Line 14: RequestStream.Close(); Line 15: // Act on the XML. <font color=red>Line 16: switch (EncodeHelper.GetTopElement(RequestXml)) { </font>Line 17: case &quot;new-order-notification&quot;: Line 18: NewOrderNotification N1 = (NewOrderNotification) EncodeHelper.Deserialize(RequestXml, typeof(NewOrderNotification));</pre></code>  </td>  </tr>  </table>  <br>  <b> Source File: </b> d:\Sites\tech2\Notifications.aspx<b> &nbsp;&nbsp; Line: </b> 16 <br><br>  <b>Stack Trace:</b> <br><br>  <table width=100% bgcolor="#ffffcc">  <tr>  <td>  <code><pre> [XmlException: Data at the root level is invalid. Line 1, position 1.] System.Xml.XmlTextReaderImpl.Throw(Exception e) +76 System.Xml.XmlTextReaderImpl.Throw(String res, String arg) +126 System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() +3975494 System.Xml.XmlTextReaderImpl.ParseDocumentContent() +187 System.Xml.XmlTextReaderImpl.Read() +151 System.Xml.XmlTextReader.Read() +15 GCheckout.Util.EncodeHelper.GetTopElement(Stream Xml) in C:\Work\googlecode\gcheckout\lib\Util\EncodeHelper.cs:148 GCheckout.Util.EncodeHelper.GetTopElement(Byte[] Xml) in C:\Work\googlecode\gcheckout\lib\Util\EncodeHelper.cs:88 GCheckout.Util.EncodeHelper.GetTopElement(String Xml) in C:\Work\googlecode\gcheckout\lib\Util\EncodeHelper.cs:114 ASP.notifications_aspx.Page_Load(Object sender, EventArgs e) in d:\Sites\tech2\Notifications.aspx:16 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 </pre></code>  </td>  </tr>  </table>  <br>  <hr width=100% size=1 color=silver>  <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.5053 </font>  </body> </html> <!-- [XmlException]: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlTextReader.Read() at GCheckout.Util.EncodeHelper.GetTopElement(Stream Xml) in C:\Work\googlecode\gcheckout\lib\Util\EncodeHelper.cs:line 148 at GCheckout.Util.EncodeHelper.GetTopElement(Byte[] Xml) in C:\Work\googlecode\gcheckout\lib\Util\EncodeHelper.cs:line 88 at GCheckout.Util.EncodeHelper.GetTopElement(String Xml) in C:\Work\googlecode\gcheckout\lib\Util\EncodeHelper.cs:line 114 at ASP.notifications_aspx.Page_Load(Object sender, EventArgs e) in d:\Sites\tech2\Notifications.aspx:line 16 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.notifications_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\d4056d14\8cf5e5c6\App_Web_sascrtij.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --><!-- This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using &lt;customErrors mode="Off"/&gt;. Consider using &lt;customErrors mode="On"/&gt; or &lt;customErrors mode="RemoteOnly"/&gt; in production environments.-->

1 个答案:

答案 0 :(得分:0)

Integration Console中的错误提示您的服务器未正确确认通知:

http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Notification_API.html#responding_to_notifications

有些事情要尝试:

  1. 确认您正确解析通知并正确发回确认。

  2. 验证XML响应是否已正确格式化。与HTML不同,XML解析器在空格方面很挑剔,一般都是低级大写,一般是正确的语法。