0
votes

I am trying to implement google checkout with Notifications Api as i want to get and store the order information in my own database. Google checkout is implemented, order gets placed and payment is done but i am unable to get the notifications from google checkout. I have tried all the settings in Google Checkout's Merchant account stated in http://surinder.computing-studio.com/ and done code as listed in the above article but still unable to get the notifications. The error i get in intergration console of my Merchant account is :

We encountered an error trying to access your server at http://www.techieticket.co.uk/Notifications.aspx -- the error we got is

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

1 Answers

0
votes

The error in the Integration Console sugges that your server is not correctly acknowledging the notification:

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

Some things to try:

  1. Verify that you are correctly parsing the notification and correctly sending back the acknowledgement.

  2. Verify that the XML response is correctly formated. Unlike HTML, XML parsers are picky about whitespaces, lower vs upper-case, proper syntax in general.