In the java example code which comes with the source distribution, the
command line examples use a mechanism for getting the xml out of the
feed via the server.getResponseStream()  (It doesn't work on batches
IMHO, see issue 742).
Since it's only a 1Mb, it sure would be nice to get the xml back a
little more straightforwardly.

On Jul 8, 8:30 am, Frank Mantek <[EMAIL PROTECTED]> wrote:
> This is from the .NET source code (parser for the batch error)...
>
>                  // status can have one child element, errors
>                  // for now disabled, as this is currently not  
> supported on the server
>                  // instead the errors come as encoded strings
>                  /*
>                  int lvl = -1;
>                  while(NextChildElement(reader, ref lvl))
>                  {
>                      localname = reader.LocalName;
>
>                      if (localname.Equals(this.nameTable.BatchErrors))
>                      {
>                          // author.Name =                
> Utilities.DecodeString(Utilities.DecodedValue(reader.ReadString()));
>                          status.Errors = ParseBatchErrors(reader);
>                      }
>                  }
>                  */
>
> So the server must have changed that behavior at one point in time and  
> i was not in the loop :)
>
> The code was written a LONG time ago, so just enabling this and the  
> corresponding property might not be sufficient.
>
> I won't have time to fix this soon (i am travelling now, and then i am  
> on vacation), but if you would file a bug report here, preferably with  
> a case how to repro this (meaning what's the cheapest way to create a  
> batch error collection):
>
> http://code.google.com/p/google-gdata
>
> I am going to make sure i fix that when i am back in around 4 weeks.  
> meanwhile feel free to uncomment that code and the corresponding  
> property in the batchstatus, compile and hopefully it works fine.
>
> Frank Mantek
> Google
>
> On Jul 7, 2008, at 8:46 AM, paul s wrote:
>
>
>
> > Eric,
>
> > No, unfortunately not.
>
> > This just gives the info from the <batch:status code='400'
> > reason='Invalid item' content-
> > type='application/xml'> As you can see, this isn't very descriptive or
> > useful, BUT, the underlying XML does have an errors collection which
> > doesn't seem to be accessible via the API.
>
> > What is actually needed is the info from the <errors> collection that
> > follows it, so in my example above:
> > <errors>
> >  <error type="data" field="expiration_date" reason="Invalid type
> > specified ('text') for field 'expiration_date'.  Please omit type or
> > specify type 'datetimerange'." />
> >  <error type="data" field="price_type" reason="Invalid price type" />
> > </errors>
>
> > - I want to be able to get to that useful info about the field
> > expiration_date having an invalid type specified - takes me straight
> > to the error rather than spending 20 minutes with a packet sniffer -
> > but this doesn't seem to be available anywhere within the API.
>
> > Thanks
> > Paul
>
> > On Jul 5, 2:10 am, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
> >> Hi Paul,
>
> >> Does something like this work?
>
> >> AtomFeed resultFeed = service.Batch(batchFeed, new
> >> Uri(baseFeed.Batch));
>
> >>  foreach (AtomEntry resultEntry in resultFeed.Entries )
> >>  {
> >>     GDataBatchEntryData data = resultEntry.BatchData;
> >>     data.Status.Code/Reason/Type.....
>
> >> }
>
> >> Eric
>
> >> On Jul 4, 7:02 am, paul s <[EMAIL PROTECTED]> wrote:
>
> >>> OK, it looks like this isn't possible, but this is a major oversight
> >>> if so! I'm having to use a packet sniffer just to find out why an  
> >>> item
> >>> has been rejected! Is there any way to at least access the raw XML  
> >>> so
> >>> that I can parse this myself in case of an error?
>
> >>> Any help much appreciated
> >>> - Paul
>
> >>> On 3 Jul, 09:55, paul s <[EMAIL PROTECTED]> wrote:
>
> >>>> Thanks for your reply, Eric.
>
> >>>> The problem I have is that the status code and message only  
> >>>> return the
> >>>> <batch:status> "code" and "reason" attributes. In my case this is  
> >>>> just
> >>>> "400" and "Invalid Item" respectively. This really isn't enough
> >>>> information to know what's gone wrong! The *real* error information
> >>>> that I need to access is in the <errors> node of the XML.
> >>>> i.e. Invalid type specified ('text') for field 'expiration_date'.
> >>>> Please omit type or specify type 'datetimerange'
> >>>> - but I can't find a way of accessing this info via the C# API
>
> >>>> Can you tell me how you access the <errors> node in the C# API,
> >>>> please ?
>
> >>>> Thanks,
> >>>> - Paul
>
> >>>> On 3 Jul, 01:22, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
>
> >>>>> Hi Paul,
>
> >>>>> Spreadsheets has a nice example of using batch requests
> >>>>> and checking the BatchData.Status.Code here:
>
> >>>>>http://code.google.com/apis/spreadsheets/developers_guide_dotnet.html
> >>>>> ...
>
> >>>>> I'll look into getting this documented for the Base API.
>
> >>>>> Eric
>
> >>>>> On Jul 2, 7:40 am, paul s <[EMAIL PROTECTED]> wrote:
>
> >>>>>> When I submit a feed to Google Base, all my items were being  
> >>>>>> returned
> >>>>>> with an "Invalid Item" response. I could find no way of finding  
> >>>>>> out
> >>>>>> what the reason that it was invalid actually was through the c#  
> >>>>>> API,
> >>>>>> which left me wondering how I could find out why my items were  
> >>>>>> being
> >>>>>> rejected!
>
> >>>>>> However, if I set up a packet sniffer and see the actual XML  
> >>>>>> traffic
> >>>>>> coming back from Google, I can see that detailed error details  
> >>>>>> are
> >>>>>> being returned by Google, as follows:
>
> >>>>>> <?xml version='1.0' encoding='UTF-8'?>
> >>>>>> <atom:feed xmlns:atom='http://www.w3.org/2005/Atom'
> >>>>>> xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
> >>>>>> xmlns:gm='http://base.google.com/ns-metadata/1.0'xmlns:g='http://
> >>>>>> base.google.com/ns/1.0' xmlns:batch='http://schemas.google.com/gdata/
> >>>>>> batch'>
> >>>>>> <atom:id>http://www.google.com/base/feeds/items</atom:id>
> >>>>>> <atom:updated>2008-07-02T13:33:03.334Z</atom:updated>
> >>>>>> <atom:title type='text'>Batch Feed</atom:title>
> >>>>>> <atom:link rel='http://schemas.google.com/g/2005#feed'
> >>>>>> type='application/atom+xml' href='http://www.google.com/base/feeds/
> >>>>>> items'/>
> >>>>>> <atom:link rel='http://schemas.google.com/g/2005#post'
> >>>>>> type='application/atom+xml' href='http://www.google.com/base/feeds/
> >>>>>> items'/>
> >>>>>> <atom:link rel='http://schemas.google.com/g/2005#batch'
> >>>>>> type='application/atom+xml' href='http://www.google.com/base/feeds/
> >>>>>> items/batch'/>
> >>>>>> <atom:entry><atom:id>1</atom:id>
> >>>>>> <atom:updated>2008-07-02T13:33:03.334Z</atom:updated>
> >>>>>> <atom:title type='text'>Error</atom:title>
> >>>>>> <atom:content type='text'>Invalid item</atom:content>
> >>>>>> <batch:id>1</batch:id>
> >>>>>> <batch:status code='400' reason='Invalid item' content-
> >>>>>> type='application/xml'>
> >>>>>> <errors>
> >>>>>>   <error type="data" field="expiration_date" reason="Invalid type
> >>>>>> specified ('text') for field 'expiration_date'.  Please omit  
> >>>>>> type or
> >>>>>> specify type 'datetimerange'." />
> >>>>>>   <error type="data" field="price_type" reason="Invalid price  
> >>>>>> type" />
> >>>>>> </errors>
> >>>>>> </batch:status>
> >>>>>> <batch:operation type='insert'/>
> >>>>>> </atom:entry>
> >>>>>> </atom:feed>
>
> >>>>>> So now I can see the reason for rejection, but I still don't  
> >>>>>> know how
> >>>>>> to access this level of detail from the C# API.
>
> >>>>>> Can anyone tell me how this might be possible? I was looking for
> >>>>>> something like a GBaseEntry.Errors collection, or a
> >>>>>> GBaseEntry.BatchData.Errors collection, or a
> >>>>>> GBaseEntry.BatchData.Status.Errors collection... none of which  
> >>>>>> seem to
> >>>>>> exist! Surely it can't be the case that we need to view HTTP  
> >>>>>> traffic
> >>>>>> to find out the reason for rejection?
>
> >>>>>> Thanks in advance!
> >>>>>> - Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to