oTAMAKOo / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

When creating a new product in the Content API, shipping is not being saved #511

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Created a new ProductEntry object
2. Created a new Shipping object and added it to the ProductEntry.ShippingRules 
collection
3. Saved the entry object

What is the expected output? What do you see instead?
When the product was retrieved back, the shipping collection was empty. So was 
the TaxRules collection

Please refer to the example I used to test the functionality: 
http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/con
tentforshopping_sample/contentforshoppingsample.cs?r=1067

This code in its current condition using the latest google-gdata library 
produces this problem

Original issue reported on code.google.com by shak...@gmail.com on 1 Jun 2011 at 3:28

GoogleCodeExporter commented 8 years ago
I saved my entry object as xml (entry.SaveToXml) to view what was the result 
and I have pasted it at the bottom. It doesnt seem that much different from 
POST demo at http://code.google.com/apis/shopping/content/demo/demo.html other 
than the fact that the namespaces are missing (i am assuming that that is taken 
care off by the library). Any ideas why the shipping and tax information is not 
being saved?

<entry xml:lang="it">
  <sc:id>123457</sc:id>
  <sc:target_country>US</sc:target_country>
  <sc:content_language>en</sc:content_language>
  <scp:brand>ACME</scp:brand>
  <scp:condition>new</scp:condition>
  <scp:price unit="usd">25</scp:price>
  <scp:product_type>Clothing & Accessories > Clothing > Outerwear > Sweaters</scp:product_type>
  <scp:quantity>3</scp:quantity>
  <scp:shipping_weight unit="lb">0.1</scp:shipping_weight>
  <scp:color>red</scp:color>
  <scp:color>blue</scp:color>
  <scp:shipping>
    <scp:shipping_country>US</scp:shipping_country>
    <scp:shipping_region>MA</scp:shipping_region>
    <scp:shipping_service>Speedy Shipping - Ground</scp:shipping_service>
    <scp:shipping_price unit="USD">5.95</scp:shipping_price>
  </scp:shipping>
  <scp:tax>
    <scp:tax_country>US</scp:tax_country>
    <scp:tax_region>CA</scp:tax_region>
    <scp:tax_rate>8.25</scp:tax_rate>
    <scp:tax_ship>True</scp:tax_ship>
  </scp:tax>
  <sc:image_link>http://www.example.com/1.jpg</sc:image_link>
  <title type="text">Wool sweater</title>
  <link href="http://express.staging.iclearpath.com" rel="alternate" type="text/html"/>
  <content type="text">Comfortable and soft, this sweater will keep you warm on those cold winter nights. Red and blue stripes.</content>
</entry>

Original comment by shak...@gmail.com on 1 Jun 2011 at 2:46

GoogleCodeExporter commented 8 years ago
If you can reproduce the issue by sending raw requests without the client 
library, it is likely that the problem is not in the library but instead 
server-side.
Please try asking in the Content API for Shopping forum:

https://groups.google.com/forum/#!forum/google-content-api-for-shopping

Thanks
Claudio

Original comment by ccherub...@google.com on 1 Jun 2011 at 6:48

GoogleCodeExporter commented 8 years ago
No I cannot. I sent raw xml to the server and successfully created a product 
with all its shipping and tax information.

That is why it was so baffling that this problem should not have happened

Original comment by shak...@gmail.com on 1 Jun 2011 at 7:37

GoogleCodeExporter commented 8 years ago
I still don't think this issue is due to the .NET library.

Can you reproduce the issue with the Interactive Demo 
(http://code.google.com/apis/shopping/content/demo/demo.html)?
I just sent the following request:

POST https://content.googleapis.com/content/v1/123457/items/products/schema/
GData-Version: 1
Authorization: AuthSub token=1/Zqf...
Content-Type: application/atom+xml
<?xml version="1.0" encoding="utf-8"?>
<entry xml:lang="it" xmlns="http://www.w3.org/2005/Atom" 
xmlns:gd="http://schemas.google.com/g/2005">
  <sc:id xmlns:sc="http://schemas.google.com/structuredcontent/2009">123457</sc:id>
  <sc:target_country xmlns:sc="http://schemas.google.com/structuredcontent/2009">US</sc:target_country>
  <sc:content_language xmlns:sc="http://schemas.google.com/structuredcontent/2009">en</sc:content_language>
  <scp:brand xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">ACME</scp:brand>
  <scp:condition xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">new</scp:condition>
  <scp:price unit="usd" xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">25</scp:price>
  <scp:product_type xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">Clothing & Accessories > Clothing > Outerwear > Sweaters</scp:product_type>
  <scp:quantity xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">3</scp:quantity>
  <scp:shipping_weight unit="lb" xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">0.1</scp:shipping_weight>
  <scp:color xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">red</scp:color>
  <scp:color xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">blue</scp:color>
  <scp:shipping xmlns:scp="http://schemas.google.com/structuredcontent/2009">
    <scp:shipping_country xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">US</scp:shipping_country>
    <scp:shipping_region xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">MA</scp:shipping_region>
    <scp:shipping_service xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">Speedy Shipping - Ground</scp:shipping_service>
    <scp:shipping_price unit="usd" xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">5.95</scp:shipping_price>
  </scp:shipping>
  <scp:shipping xmlns:scp="http://schemas.google.com/structuredcontent/2009">
    <scp:shipping_country xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">US</scp:shipping_country>
    <scp:shipping_region xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">024*</scp:shipping_region>
    <scp:shipping_service xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">Speedy Shipping - Air</scp:shipping_service>
    <scp:shipping_price unit="usd" xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">7.95</scp:shipping_price>
  </scp:shipping>
  <scp:tax xmlns:scp="http://schemas.google.com/structuredcontent/2009">
    <scp:tax_country xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">US</scp:tax_country>
    <scp:tax_region xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">CA</scp:tax_region>
    <scp:tax_rate xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">8.25</scp:tax_rate>
    <scp:tax_ship xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">True</scp:tax_ship>
  </scp:tax>
  <scp:tax xmlns:scp="http://schemas.google.com/structuredcontent/2009">
    <scp:tax_country xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">US</scp:tax_country>
    <scp:tax_region xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">926*</scp:tax_region>
    <scp:tax_rate xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">8.75</scp:tax_rate>
    <scp:tax_ship xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">False</scp:tax_ship>
  </scp:tax>
  <sc:image_link xmlns:sc="http://schemas.google.com/structuredcontent/2009">http://www.example.com/1.jpg</sc:image_link>
  <title type="text">TEST</title>
  <link href="http://www.example.com" rel="alternate" type="text/html" />
  <content type="text">Comfortable and soft, this sweater will keep you warm on those cold winter nights. Red and blue stripes.</content>
</entry>

and got the following response, without shipping rules:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' 
xmlns:app='http://www.w3.org/2007/app' 
xmlns:sc='http://schemas.google.com/structuredcontent/2009' 
xmlns:scp='http://schemas.google.com/structuredcontent/2009/products'>
  <id>http://content.googleapis.com/content/account/123457/item/products/7800483697693438712</id>
  <published>2011-06-07T15:49:48.000Z</published>
  <updated>2011-06-07T15:49:48.901Z</updated>
  <app:edited>2011-06-07T15:49:48.901Z</app:edited>
  <app:control>
    <sc:required_destination dest='ProductSearch'/>
    <sc:status dest='ProductSearch' status='enlisted'/>
    <sc:status dest='ShoppingApi' status='enlisted'/>
    <sc:status dest='RichSnippets' status='enlisted'/>
    <sc:status dest='AffiliateNetwork' status='enlisted'/>
    <sc:status dest='ProductAds' status='enlisted'/>
  </app:control>
  <title>TEST</title>
  <content>Comfortable and soft, this sweater will keep you warm on those cold winter nights. Red and blue stripes.</content>
  <link rel='self' type='application/atom+xml' href='https://content.googleapis.com/content/v1/123457/items/products/schema/online:en:US:123457'/>
  <link rel='edit' type='application/atom+xml' href='https://content.googleapis.com/content/v1/123457/items/products/schema/online:en:US:123457'/>
  <link rel='alternate' type='text/html' href='http://www.example.com'/>
  <sc:adult>false</sc:adult>
  <sc:content_language>en</sc:content_language>
  <sc:expiration_date>2011-07-07T08:49:48.000-07:00</sc:expiration_date>
  <sc:id>123457</sc:id>
  <sc:image_link>http://www.example.com/1.jpg</sc:image_link>
  <sc:target_country>US</sc:target_country>
  <scp:price unit='USD'>25.0</scp:price>
  <scp:color>blue</scp:color>
  <scp:color>red</scp:color>
  <scp:quantity>3</scp:quantity>
  <scp:product_type>Clothing & Accessories > Clothing > Outerwear > Sweaters</scp:product_type>
  <scp:brand>ACME</scp:brand>
  <scp:shipping_weight unit='lb'>0.1</scp:shipping_weight>
  <scp:condition>new</scp:condition>
</entry>

Original comment by ccherub...@google.com on 7 Jun 2011 at 3:54

GoogleCodeExporter commented 8 years ago
No the shipping gets saved properly. I tested it with both the Interactive 
library and some code I wrote that directly does HTTP post to the google api.

Here is the xml I posted to the API using the Interaction demo:

POST https://content.googleapis.com/content/v1/8054391/items/products/schema/
GData-Version: 1
Authorization: AuthSub token=1/EZj...
Content-Type: application/atom+xml

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' 
xmlns:sc='http://schemas.google.com/structuredcontent/2009' 
xmlns:scp='http://schemas.google.com/structuredcontent/2009/products'>
  <title>Wool sweater</title>
  <content type='text'>Comfortable and soft. Red and blue stripes.</content>
  <sc:id>SKU123</sc:id>
  <link rel='alternate' type='text/html' href='http://express.staging.iclearpath.com'/>
  <scp:condition>new</scp:condition>
  <scp:price unit='USD'>25</scp:price>
  <scp:shipping>
    <scp:shipping_country>US</scp:shipping_country>
    <scp:shipping_region>MA</scp:shipping_region>
    <scp:shipping_price unit='USD'>5.95</scp:shipping_price>
    <scp:shipping_service>Speedy Shipping - Ground</scp:shipping_service>
  </scp:shipping>
  <scp:tax>
    <scp:tax_country>US</scp:tax_country>
    <scp:tax_region>CA</scp:tax_region>
    <scp:tax_rate>8.25</scp:tax_rate>
    <scp:tax_ship>true</scp:tax_ship>
  </scp:tax>
</entry>

and here is the response I got:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' 
xmlns:app='http://www.w3.org/2007/app' 
xmlns:sc='http://schemas.google.com/structuredcontent/2009' 
xmlns:scp='http://schemas.google.com/structuredcontent/2009/products'>
  <!-- Update | Delete. -->
  <id>http://content.googleapis.com/content/account/8054391/item/products/3177642278212714880</id>
  <published>2011-06-07T18:00:48.000Z</published>
  <updated>2011-06-07T18:00:55.620Z</updated>
  <app:edited>2011-06-07T18:00:55.620Z</app:edited>
  <app:control>
    <sc:required_destination dest='ProductSearch'/>
    <sc:status dest='AffiliateNetwork' status='enlisted'/>
    <sc:status dest='ProductSearch' status='enlisted'/>
    <sc:status dest='RichSnippets' status='enlisted'/>
    <sc:status dest='ShoppingApi' status='enlisted'/>
    <sc:status dest='ProductAds' status='enlisted'/>
  </app:control>
  <title>Wool sweater</title>
  <content>Comfortable and soft. Red and blue stripes.</content>
  <link rel='self' type='application/atom+xml' href='https://content.googleapis.com/content/v1/8054391/items/products/schema/online:en:US:SKU123'/>
  <link rel='edit' type='application/atom+xml' href='https://content.googleapis.com/content/v1/8054391/items/products/schema/online:en:US:SKU123'/>
  <link rel='alternate' type='text/html' href='http://express.staging.iclearpath.com'/>
  <sc:adult>false</sc:adult>
  <sc:content_language>en</sc:content_language>
  <sc:expiration_date>2011-07-07T11:00:48.000-07:00</sc:expiration_date>
  <sc:id>SKU123</sc:id>
  <sc:target_country>US</sc:target_country>
  <scp:price unit='USD'>25.0</scp:price>
  <scp:condition>new</scp:condition>
  <scp:shipping>
    <scp:shipping_service>Speedy Shipping - Ground</scp:shipping_service>
    <scp:shipping_price unit='USD'>5.95</scp:shipping_price>
    <scp:shipping_country>US</scp:shipping_country>
    <scp:shipping_region>MA</scp:shipping_region>
  </scp:shipping>
  <scp:tax>
    <scp:tax_ship>true</scp:tax_ship>
    <scp:tax_country>US</scp:tax_country>
    <scp:tax_region>CA</scp:tax_region>
    <scp:tax_rate>8.25</scp:tax_rate>
  </scp:tax>
</entry>

I cannot be sure but could it be because you are adding namespaces at the child 
node level instead of the root "entry" node level?

Original comment by shak...@gmail.com on 7 Jun 2011 at 6:05

GoogleCodeExporter commented 8 years ago
I found the error, scp:shipping and scp:tax used an incorrect namespace.

Fixed in rev. 104

Original comment by ccherub...@google.com on 9 Jun 2011 at 4:29

GoogleCodeExporter commented 8 years ago
thank you

Original comment by shak...@gmail.com on 9 Jun 2011 at 5:11