Question to "Link must have an 'href' attribute"

8 messages Options
Embed this post
Permalink
patrick_try

Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
Hello together,

I'm actually working on a manuell Insert to GBase. I fill the GBase-API with that code:

function createOrEditEntry($entry) {
  $newEntry = $entry;

  $newEntry->category['scheme'] = 'http://base.google.com/categories/itemtypes';
  $newEntry->category['term'] = 'products';

  $newEntry->title = utf8_encode($_POST['title']);
  $newEntry->content  = utf8_encode($_POST['description']);
  $newEntry->{'g:image_link'} = $_POST['image_link'];
 
  $newEntry->{'g:item_type'} = 'Produkte';
  $newEntry->{'g:price'} = utf8_encode($_POST['preis']);

  $newEntry->{'g:target_country'} = 'DE';
  $newEntry->{'g:item_language'} = 'DE';
  $newEntry->language = 'de-DE';
 
 
  $newEntry->link = $_POST['link']; //<-- Poblem!

  return $newEntry;
}


And all works fine, without the link. :-((

If I want to post it I always get the message: "Insertion failed: Post to Google failed. Reason: [Line 2, Column 774, element link] Link must have an 'href' attribute."

Does anyone know how I can send the 'href'-attribute with that code?

Thx in advance,
Patrick
Ryan Boyd-3

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
Hi Patrick,

I'm assuming you're trying to define the main link for the item's webpage representation. 

Here's how to set the link, with the rel, href and type:
  $newEntry->link['href'] = $_POST['link'];
  $newEntry->link['rel'] = 'alternate';
  $newEntry->link['type'] = 'text/html';

Cheers,
-Ryan

On Feb 17, 2008 2:43 PM, patrick_try <[hidden email]> wrote:

Hello together,

I'm actually working on a manuell Insert to GBase. I fill the GBase-API with
that code:

function createOrEditEntry($entry) {
 $newEntry = $entry;

 $newEntry->category['scheme'] =
'http://base.google.com/categories/itemtypes';
 $newEntry->category['term'] = 'products';

 $newEntry->title = utf8_encode($_POST['title']);
 $newEntry->content  = utf8_encode($_POST['description']);
 $newEntry->{'g:image_link'} = $_POST['image_link'];

 $newEntry->{'g:item_type'} = 'Produkte';
 $newEntry->{'g:price'} = utf8_encode($_POST['preis']);

 $newEntry->{'g:target_country'} = 'DE';
 $newEntry->{'g:item_language'} = 'DE';
 $newEntry->language = 'de-DE';


 $newEntry->link = $_POST['link']; //<-- Poblem!

 return $newEntry;
}


And all works fine, without the link. :-((

If I want to post it I always get the message: "Insertion failed: Post to
Google failed. Reason: [Line 2, Column 774, element link] Link must have an
'href' attribute."

Does anyone know how I can send the 'href'-attribute with that code?

Thx in advance,
Patrick
--
View this message in context: http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15535897.html
Sent from the Zend gdata mailing list archive at Nabble.com.


patrick_try

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
Hi Ryan,

thx for the really fast answer. Yes, I mean the main link for the item's webpage.

That was my first idea, too. I was trying that again and getting only the message: "Insertion failed: Post to Google failed. Reason:"
No other message and the item isn't listed in GBase.

How could I find out what's the problem or does anyone know this reaction?

Bye, Patrick
Ryan Boyd-3

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
Hi Patrick,

Is the only change between a working call and a failing call the addition of the link?

Is it possible there are some special characters in the link which aren't getting encoded?  I think the link I tried successfully was just http://www.google.com/ (and I copied/pasted the code into the e-mail from a running copy).

The 'reason' is usually the body of the HTTP response -- so, it doesn't appear the server is giving much to go on here (other than perhaps a status code which isn't being printed).  Can you send me the results of $newEntry->saveXML() ?

Cheers,
-Ryan



On Feb 18, 2008 12:59 AM, patrick_try <[hidden email]> wrote:

Hi Ryan,

thx for the really fast answer. Yes, I mean the main link for the item's
webpage.

That was my first idea, too. I was trying that again and getting only the
message: "Insertion failed: Post to Google failed. Reason:"
No other message and the item isn't listed in GBase.

How could I find out what's the problem or does anyone know this reaction?
:confused:

Bye, Patrick
--
View this message in context: http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15541010.html
Sent from the Zend gdata mailing list archive at Nabble.com.


patrick_try

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
THX for the help.

Yes, only the Link seems to be problematic. Even the "http://www.google.com/"-Link doesn't work.

The generated TEST-XML-File before it fills the GBase-API is:
---------
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0"><category scheme="http://base.google.com/categories/itemtypes" term="products"/><title>Tessst 999</title><content>Schöner Läbün</content><g:image_link xmlns:g="http://base.google.com/ns/1.0">http://shop2.o2online.de/nw/assets/shop/bilder/produkte/o2/o2-genion-1092-000007-00-big-bild.jpg</g:image_link><g:item_type xmlns:g="http://base.google.com/ns/1.0">Produkte</g:item_type><g:price xmlns:g="http://base.google.com/ns/1.0">99,87 €</g:price><g:target_country xmlns:g="http://base.google.com/ns/1.0">DE</g:target_country><g:item_language xmlns:g="http://base.google.com/ns/1.0">DE</g:item_language><language>de-DE</language><link href="http://www.google.com/" rel="alternate" type="text/html"/></entry>

---------

The Euro-Sign could stand there in Text "Eur", too - that doens't change anything.






Ryan Boyd-3 wrote:
Hi Patrick,

Is the only change between a working call and a failing call the addition of
the link?

Is it possible there are some special characters in the link which aren't
getting encoded?  I think the link I tried successfully was just
http://www.google.com/ (and I copied/pasted the code into the e-mail from a
running copy).

The 'reason' is usually the body of the HTTP response -- so, it doesn't
appear the server is giving much to go on here (other than perhaps a status
code which isn't being printed).  Can you send me the results of
$newEntry->saveXML() ?

Cheers,
-Ryan



On Feb 18, 2008 12:59 AM, patrick_try <try.out@gmx.de> wrote:

>
> Hi Ryan,
>
> thx for the really fast answer. Yes, I mean the main link for the item's
> webpage.
>
> That was my first idea, too. I was trying that again and getting only the
> message: "Insertion failed: Post to Google failed. Reason:"
> No other message and the item isn't listed in GBase.
>
> How could I find out what's the problem or does anyone know this reaction?
> :confused:
>
> Bye, Patrick
> --
> View this message in context:
> http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15541010.html
> Sent from the Zend gdata mailing list archive at Nabble.com.
>
>
Ryan Boyd-3

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
Hi Patrick,

I just tried inserting this entry for my account and the only error I got was:
  <error type="data" field="price" reason="Invalid currency: &quot;€&quot;. Please enter an ISO 4217 currency code. http://www.unicode.org/cldr/data/diff/supplemental/supplemental.html" />

After changing the Euro-Sign to EUR, or eliminating it and adding a g:currency element with the same, the entry inserted correctly.  However, you mentioned this didn't work for you, so I'm not sure what's next.

I bcc'd someone who knows Base really well and will also try and find other methods of debugging this and let you know. 

Thanks,
-Ryan


On Feb 20, 2008 1:26 AM, patrick_try <[hidden email]> wrote:

THX for the help.

Yes, only the Link seems to be problematic. Even the
"http://www.google.com/"-Link doesn't work.

The generated TEST-XML-File before it fills the GBase-API is:
---------
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:g="http://base.google.com/ns/1.0"><category
term="products"/><title>Tessst 999</title><content>Schöner
Läbün</content><g:image_link
xmlns:g="http://base.google.com/ns/1.0">http://shop2.o2online.de/nw/assets/shop/bilder/produkte/o2/o2-genion-1092-000007-00-big-bild.jpg</g:image_link><g:item_type
xmlns:g="http://base.google.com/ns/1.0">Produkte</g:item_type><g:price
xmlns:g="http://base.google.com/ns/1.0">99,87 €</g:price><g:target_country
xmlns:g="http://base.google.com/ns/1.0">DE</g:target_country><g:item_language
xmlns:g="http://base.google.com/ns/1.0">DE</g:item_language><language>de-DE</language><link
href="http://www.google.com/" rel="alternate" type="text/html"/></entry>

---------

The Euro-Sign could stand there in Text "Eur", too - that doens't change
anything.







Ryan Boyd-3 wrote:
>
> Hi Patrick,
>
> Is the only change between a working call and a failing call the addition
> of
> the link?
>
> Is it possible there are some special characters in the link which aren't
> getting encoded?  I think the link I tried successfully was just
> http://www.google.com/ (and I copied/pasted the code into the e-mail from
> a
> running copy).
>
> The 'reason' is usually the body of the HTTP response -- so, it doesn't
> appear the server is giving much to go on here (other than perhaps a
> status
> code which isn't being printed).  Can you send me the results of
> $newEntry->saveXML() ?
>
> Cheers,
> -Ryan
>
>
>
> On Feb 18, 2008 12:59 AM, patrick_try <[hidden email]> wrote:
>
>>
>> Hi Ryan,
>>
>> thx for the really fast answer. Yes, I mean the main link for the item's
>> webpage.
>>
>> That was my first idea, too. I was trying that again and getting only the
>> message: "Insertion failed: Post to Google failed. Reason:"
>> No other message and the item isn't listed in GBase.
>>
>> How could I find out what's the problem or does anyone know this
>> reaction?
>> :confused:
>>
>> Bye, Patrick
>> --
>> View this message in context:
>> http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15541010.html
>> Sent from the Zend gdata mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15585264.html
Sent from the Zend gdata mailing list archive at Nabble.com.


patrick_try

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
Hi Ryan,

it works!

The error was on the one hand the Euro-Sign, but also the URI. Sometimes it works sometimes not. I try to find the reason and post it here.
Never forget: GBase self is BETA and they have some problems also. I cannot delete my test-items in my g-Account. But I informed Google, we'll see what happend.
So far, THANK YOU VERY MUCH!

Bye,Patrick

Ryan Boyd-3 wrote:
Hi Patrick,

I just tried inserting this entry for my account and the only error I got
was:
  <error type="data" field="price" reason="Invalid currency: "€".
Please enter an ISO 4217 currency code.
http://www.unicode.org/cldr/data/diff/supplemental/supplemental.html" />

After changing the Euro-Sign to EUR, or eliminating it and adding a
g:currency element with the same, the entry inserted correctly.  However,
you mentioned this didn't work for you, so I'm not sure what's next.

I bcc'd someone who knows Base really well and will also try and find other
methods of debugging this and let you know.

Thanks,
-Ryan


On Feb 20, 2008 1:26 AM, patrick_try <try.out@gmx.de> wrote:

>
> THX for the help.
>
> Yes, only the Link seems to be problematic. Even the
> "http://www.google.com/"-Link doesn't work.
>
> The generated TEST-XML-File before it fills the GBase-API is:
> ---------
> <?xml version="1.0" encoding="utf-8"?>
> <entry xmlns="http://www.w3.org/2005/Atom"
> xmlns:g="http://base.google.com/ns/1.0"><category
> scheme="http://base.google.com/categories/itemtypes"
> term="products"/><title>Tessst 999</title><content>Schöner
> Läbün</content><g:image_link
> xmlns:g="http://base.google.com/ns/1.0">
> http://shop2.o2online.de/nw/assets/shop/bilder/produkte/o2/o2-genion-1092-000007-00-big-bild.jpg
> </g:image_link><g:item_type
> xmlns:g="http://base.google.com/ns/1.0">Produkte</g:item_type><g:price
> xmlns:g="http://base.google.com/ns/1.0">99,87 €</g:price><g:target_country
> xmlns:g="http://base.google.com/ns/1.0
> ">DE</g:target_country><g:item_language
> xmlns:g="http://base.google.com/ns/1.0
> ">DE</g:item_language><language>de-DE</language><link
> href="http://www.google.com/" rel="alternate" type="text/html"/></entry>
>
> ---------
>
> The Euro-Sign could stand there in Text "Eur", too - that doens't change
> anything.
>
>
>
>
>
>
>
> Ryan Boyd-3 wrote:
> >
> > Hi Patrick,
> >
> > Is the only change between a working call and a failing call the
> addition
> > of
> > the link?
> >
> > Is it possible there are some special characters in the link which
> aren't
> > getting encoded?  I think the link I tried successfully was just
> > http://www.google.com/ (and I copied/pasted the code into the e-mail
> from
> > a
> > running copy).
> >
> > The 'reason' is usually the body of the HTTP response -- so, it doesn't
> > appear the server is giving much to go on here (other than perhaps a
> > status
> > code which isn't being printed).  Can you send me the results of
> > $newEntry->saveXML() ?
> >
> > Cheers,
> > -Ryan
> >
> >
> >
> > On Feb 18, 2008 12:59 AM, patrick_try <try.out@gmx.de> wrote:
> >
> >>
> >> Hi Ryan,
> >>
> >> thx for the really fast answer. Yes, I mean the main link for the
> item's
> >> webpage.
> >>
> >> That was my first idea, too. I was trying that again and getting only
> the
> >> message: "Insertion failed: Post to Google failed. Reason:"
> >> No other message and the item isn't listed in GBase.
> >>
> >> How could I find out what's the problem or does anyone know this
> >> reaction?
> >> :confused:
> >>
> >> Bye, Patrick
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15541010.html
> >> Sent from the Zend gdata mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Question-to-%22Link-must-have-an-%27href%27-attribute%22-tp15535897s16154p15585264.html
> Sent from the Zend gdata mailing list archive at Nabble.com.
>
>
patrick_try

Re: Question to "Link must have an 'href' attribute"

Reply Threaded More More options
Print post
Permalink
The problem was, that in the URL contains special characters. Not really, but if there stands e.g. ...uuml... sees Google "& u u m l ;" what means ü

Hard to find out, but good to know