|
Home > Archive > Commerce Server General > June 2006 > Product Addition through catalog webservice error
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Product Addition through catalog webservice error
|
|
| Prasenjit 2006-06-25, 7:32 pm |
| I am trying to add a product to cs catalog at runtime using catalog web
service.The defintion of the product already exists in catalog.Code block is
given below:
private CatalogServiceAgent catalogServiceAgent;
private CatalogContext catalogContext;
private BaseCatalog bc;
private VirtualCatalog vc;
webserviceurl=ConfigurationSettings.AppSettings["webserviceurl"].ToString();
catalogServiceAgent=new
CatalogServiceAgent(webserviceurl,Servic
eAgent.DefaultAuthMethods);
catalogContext= CatalogContext.Create(catalogServiceAgent,new
WebDebugContext(DebugMode.Checked));
bc=(BaseCatalog)catalogContext.GetCatalog("TravelCareCatalog","en-UK");
vc=(VirtualCatalog)catalogContext.GetCatalog("TravelCareVirtualCatalog","en-UK");
Microsoft.CatalogServer.Product p=bc.CreateProduct("Accommodation",AccomGUID);
p.AddParentCategory("AccommCategory");
p.AddVariant("1");
p.Variants.CatalogItems[0].DisplayName="ddd";
p.Variants.CatalogItems[0].ListPrice=20.00;
p.Variants.CatalogItems[0]["Name"]="ddd";
p.Save();
vc.Rebuild(true);
Thread.Sleep(1000);
You may notice that there is a 'Thread.Sleep(1000)'.
Problem is if i remove this line from code at times a get an error while
executing the code.It appears that Virtual catalog is taking time to rebuild.
I am adding the product to basket immediately after adding it to the CS
Catalog.
I am using CS 2000 enterprise version in windows 2003 server.
Can u give any reason for the problem.
| |
| Vinayak Tadas[MSFT] 2006-06-27, 7:16 pm |
| Any reason you are using virtual catalogs to do this.
Can't you create the product in the base catalog and use it from there.
This way you dont need to rebuild the virtual catalog.
Thanks
Vinayak Tadas
Microsoft
http://blogs.msdn.com/vinayakt
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Get Secure! For more info visit http://www.microsoft.com/security. Please
reply to the newsgroups only
--------------------
Thread-Topic: Product Addition through catalog webservice error
thread-index: AcaYi8wtcxpxDCYyQAC8YnmAcp5iBg==
X-WBNR-Posting-Host: 217.33.9.79
From: =?Utf-8?B?UHJhc2Vuaml0?= <Prasenjit@discussions.microsoft.com>
Subject: Product Addition through catalog webservice error
Date: Sun, 25 Jun 2006 12:16:02 -0700
Lines: 40
Message-ID: <FD0593A5-C41C-4F5A-A409-270ADA4340A7@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.commerceserver.general
Path: TK2MSFTNGXA01.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:17960
NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.commerceserver.general
I am trying to add a product to cs catalog at runtime using catalog web
service.The defintion of the product already exists in catalog.Code block
is
given below:
private CatalogServiceAgent catalogServiceAgent;
private CatalogContext catalogContext;
private BaseCatalog bc;
private VirtualCatalog vc;
webserviceurl=ConfigurationSettings.AppSettings["webserviceurl"].ToString();
catalogServiceAgent=new
CatalogServiceAgent(webserviceurl,Servic
eAgent.DefaultAuthMethods);
catalogContext= CatalogContext.Create(catalogServiceAgent,new
WebDebugContext(DebugMode.Checked));
bc=(BaseCatalog)catalogContext.GetCatalog("TravelCareCatalog","en-UK");
vc=(VirtualCatalog)catalogContext.GetCatalog("TravelCareVirtualCatalog","en-
UK");
Microsoft.CatalogServer.Product
p=bc.CreateProduct("Accommodation",AccomGUID);
p.AddParentCategory("AccommCategory");
p.AddVariant("1");
p.Variants.CatalogItems[0].DisplayName="ddd";
p.Variants.CatalogItems[0].ListPrice=20.00;
p.Variants.CatalogItems[0]["Name"]="ddd";
p.Save();
vc.Rebuild(true);
Thread.Sleep(1000);
You may notice that there is a 'Thread.Sleep(1000)'.
Problem is if i remove this line from code at times a get an error while
executing the code.It appears that Virtual catalog is taking time to
rebuild.
I am adding the product to basket immediately after adding it to the CS
Catalog.
I am using CS 2000 enterprise version in windows 2003 server.
Can u give any reason for the problem.
| |
| Prasenjit 2006-06-28, 7:23 am |
| Hi,
contraint of the project is that product information come from third
party database in runtime.So i am trying to add product to catalog at runtime.
I am using CS 2002 enterprise version.
prasenjit
""Vinayak Tadas[MSFT]"" wrote:
> Any reason you are using virtual catalogs to do this.
> Can't you create the product in the base catalog and use it from there.
> This way you dont need to rebuild the virtual catalog.
>
> Thanks
> Vinayak Tadas
> Microsoft
> http://blogs.msdn.com/vinayakt
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> You assume all risk for your use. © 2002 Microsoft Corporation. All rights
> reserved.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> Get Secure! For more info visit http://www.microsoft.com/security. Please
> reply to the newsgroups only
>
>
> --------------------
> Thread-Topic: Product Addition through catalog webservice error
> thread-index: AcaYi8wtcxpxDCYyQAC8YnmAcp5iBg==
> X-WBNR-Posting-Host: 217.33.9.79
> From: =?Utf-8?B?UHJhc2Vuaml0?= <Prasenjit@discussions.microsoft.com>
> Subject: Product Addition through catalog webservice error
> Date: Sun, 25 Jun 2006 12:16:02 -0700
> Lines: 40
> Message-ID: <FD0593A5-C41C-4F5A-A409-270ADA4340A7@microsoft.com>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="Utf-8"
> Content-Transfer-Encoding: 7bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Content-Class: urn:content-classes:message
> Importance: normal
> Priority: normal
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
> Newsgroups: microsoft.public.commerceserver.general
> Path: TK2MSFTNGXA01.phx.gbl
> Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:17960
> NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
> X-Tomcat-NG: microsoft.public.commerceserver.general
>
> I am trying to add a product to cs catalog at runtime using catalog web
> service.The defintion of the product already exists in catalog.Code block
> is
> given below:
>
> private CatalogServiceAgent catalogServiceAgent;
> private CatalogContext catalogContext;
> private BaseCatalog bc;
> private VirtualCatalog vc;
>
> webserviceurl=ConfigurationSettings.AppSettings["webserviceurl"].ToString();
> catalogServiceAgent=new
> CatalogServiceAgent(webserviceurl,Servic
eAgent.DefaultAuthMethods);
> catalogContext= CatalogContext.Create(catalogServiceAgent,new
> WebDebugContext(DebugMode.Checked));
> bc=(BaseCatalog)catalogContext.GetCatalog("TravelCareCatalog","en-UK");
>
> vc=(VirtualCatalog)catalogContext.GetCatalog("TravelCareVirtualCatalog","en-
> UK");
>
> Microsoft.CatalogServer.Product
> p=bc.CreateProduct("Accommodation",AccomGUID);
> p.AddParentCategory("AccommCategory");
> p.AddVariant("1");
>
> p.Variants.CatalogItems[0].DisplayName="ddd";
> p.Variants.CatalogItems[0].ListPrice=20.00;
> p.Variants.CatalogItems[0]["Name"]="ddd";
> p.Save();
>
> vc.Rebuild(true);
> Thread.Sleep(1000);
>
> You may notice that there is a 'Thread.Sleep(1000)'.
>
> Problem is if i remove this line from code at times a get an error while
> executing the code.It appears that Virtual catalog is taking time to
> rebuild.
>
> I am adding the product to basket immediately after adding it to the CS
> Catalog.
> I am using CS 2000 enterprise version in windows 2003 server.
> Can u give any reason for the problem
| |
| Vinayak Tadas[MSFT] 2006-06-28, 7:17 pm |
| From your code sample I dont understand why you need to rebuild the virtual
catalog if you are simply adding the product to the base catalog.
You can add the product to the base catalog and run the pipeline on the
base catalog product
Thanks
Vinayak Tadas
Microsoft
http://blogs.msdn.com/vinayakt
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Get Secure! For more info visit http://www.microsoft.com/security. Please
reply to the newsgroups only
--------------------
Thread-Topic: Product Addition through catalog webservice error
thread-index: AcaanGq+3YPdBoMgSvCQVYIXpYnJPQ==
X-WBNR-Posting-Host: 217.33.9.79
From: =?Utf-8?B?UHJhc2Vuaml0?= <Prasenjit@discussions.microsoft.com>
References: <FD0593A5-C41C-4F5A-A409-270ADA4340A7@microsoft.com>
<lgE81ejmGHA.4948@TK2MSFTNGXA01.phx.gbl>
Subject: RE: Product Addition through catalog webservice error
Date: Wed, 28 Jun 2006 03:20:02 -0700
Lines: 95
Message-ID: <38FA3BA0-ABF1-40CE-B34F-ECC359A9D0E5@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.commerceserver.general
Path: TK2MSFTNGXA01.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:17985
NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.commerceserver.general
Hi,
contraint of the project is that product information come from third
party database in runtime.So i am trying to add product to catalog at
runtime.
I am using CS 2002 enterprise version.
prasenjit
""Vinayak Tadas[MSFT]"" wrote:
> Any reason you are using virtual catalogs to do this.
> Can't you create the product in the base catalog and use it from there.
> This way you dont need to rebuild the virtual catalog.
>
> Thanks
> Vinayak Tadas
> Microsoft
> http://blogs.msdn.com/vinayakt
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. © 2002 Microsoft Corporation. All
rights
> reserved.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> Get Secure! For more info visit http://www.microsoft.com/security.
Please
> reply to the newsgroups only
>
>
> --------------------
> Thread-Topic: Product Addition through catalog webservice error
> thread-index: AcaYi8wtcxpxDCYyQAC8YnmAcp5iBg==
> X-WBNR-Posting-Host: 217.33.9.79
> From: =?Utf-8?B?UHJhc2Vuaml0?= <Prasenjit@discussions.microsoft.com>
> Subject: Product Addition through catalog webservice error
> Date: Sun, 25 Jun 2006 12:16:02 -0700
> Lines: 40
> Message-ID: <FD0593A5-C41C-4F5A-A409-270ADA4340A7@microsoft.com>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="Utf-8"
> Content-Transfer-Encoding: 7bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Content-Class: urn:content-classes:message
> Importance: normal
> Priority: normal
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
> Newsgroups: microsoft.public.commerceserver.general
> Path: TK2MSFTNGXA01.phx.gbl
> Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:17960
> NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
> X-Tomcat-NG: microsoft.public.commerceserver.general
>
> I am trying to add a product to cs catalog at runtime using catalog web
> service.The defintion of the product already exists in catalog.Code block
> is
> given below:
>
> private CatalogServiceAgent catalogServiceAgent;
> private CatalogContext catalogContext;
> private BaseCatalog bc;
> private VirtualCatalog vc;
>
>
webserviceurl=ConfigurationSettings.AppSettings["webserviceurl"].ToString();
> catalogServiceAgent=new
> CatalogServiceAgent(webserviceurl,Servic
eAgent.DefaultAuthMethods);
> catalogContext= CatalogContext.Create(catalogServiceAgent,new
> WebDebugContext(DebugMode.Checked));
> bc=(BaseCatalog)catalogContext.GetCatalog("TravelCareCatalog","en-UK");
>
>
vc=(VirtualCatalog)catalogContext.GetCatalog("TravelCareVirtualCatalog","en-
> UK");
>
> Microsoft.CatalogServer.Product
> p=bc.CreateProduct("Accommodation",AccomGUID);
> p.AddParentCategory("AccommCategory");
> p.AddVariant("1");
>
> p.Variants.CatalogItems[0].DisplayName="ddd";
> p.Variants.CatalogItems[0].ListPrice=20.00;
> p.Variants.CatalogItems[0]["Name"]="ddd";
> p.Save();
>
> vc.Rebuild(true);
> Thread.Sleep(1000);
>
> You may notice that there is a 'Thread.Sleep(1000)'.
>
> Problem is if i remove this line from code at times a get an error while
> executing the code.It appears that Virtual catalog is taking time to
> rebuild.
>
> I am adding the product to basket immediately after adding it to the CS
> Catalog.
> I am using CS 2000 enterprise version in windows 2003 server.
> Can u give any reason for the problem
| |
| Prasenjit 2006-06-29, 7:26 am |
| Hi,
Vinayak,
I am using the virtual catalog to add the item to basket using the
code:
basket = CommerceContext.Current.OrderSystem.GetBasket(new Guid(userID));
LineItem li = new LineItem();
li.ProductID = ProductGUID+"(TravelCareCatalog)";
li.ProductVariantID = SKU;
li.ProductCatalog = "TravelCareVirtualCatalog";
li.Quantity = 1;
li.ProductCategory=producttype+"Category";
OrderContext oc = CommerceContext.Current.OrderSystem;
OrderForm of;
if(basket.OrderForms[quoteno]==null)
{
basket.OrderForms.Add(new OrderForm(quoteno));
}
of = basket.OrderForms[quoteno];
of.LineItems.Add(li);
basket.Save();
I may do with not using Virtual Catalog.But that would need huge change in
the coding throughout the project.That i want to avoid.So please give me a
reason why
addition of product to base catalog and then rebuilding the Virtual catalog
to add the product to basket from virtual catalog is requiring
'Thread.Sleep'.That definitely means that this version of CS is having
problems in rebuilding Virtual catalog from code.Please suggest a way out.
with regards,
Prasenjit
Software Enginner,
HCL Technologies
""Vinayak Tadas[MSFT]"" wrote:
> From your code sample I dont understand why you need to rebuild the virtual
> catalog if you are simply adding the product to the base catalog.
> You can add the product to the base catalog and run the pipeline on the
> base catalog product
> Thanks
> Vinayak Tadas
> Microsoft
> http://blogs.msdn.com/vinayakt
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> You assume all risk for your use. © 2002 Microsoft Corporation. All rights
> reserved.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> Get Secure! For more info visit http://www.microsoft.com/security. Please
> reply to the newsgroups only
>
>
> --------------------
> Thread-Topic: Product Addition through catalog webservice error
> thread-index: AcaanGq+3YPdBoMgSvCQVYIXpYnJPQ==
> X-WBNR-Posting-Host: 217.33.9.79
> From: =?Utf-8?B?UHJhc2Vuaml0?= <Prasenjit@discussions.microsoft.com>
> References: <FD0593A5-C41C-4F5A-A409-270ADA4340A7@microsoft.com>
> <lgE81ejmGHA.4948@TK2MSFTNGXA01.phx.gbl>
> Subject: RE: Product Addition through catalog webservice error
> Date: Wed, 28 Jun 2006 03:20:02 -0700
> Lines: 95
> Message-ID: <38FA3BA0-ABF1-40CE-B34F-ECC359A9D0E5@microsoft.com>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="Utf-8"
> Content-Transfer-Encoding: 8bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Content-Class: urn:content-classes:message
> Importance: normal
> Priority: normal
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
> Newsgroups: microsoft.public.commerceserver.general
> Path: TK2MSFTNGXA01.phx.gbl
> Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:17985
> NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
> X-Tomcat-NG: microsoft.public.commerceserver.general
>
> Hi,
> contraint of the project is that product information come from third
> party database in runtime.So i am trying to add product to catalog at
> runtime.
> I am using CS 2002 enterprise version.
>
>
> prasenjit
>
> ""Vinayak Tadas[MSFT]"" wrote:
>
> rights.
> rights
> Please
> webserviceurl=ConfigurationSettings.AppSettings["webserviceurl"].ToString();
> vc=(VirtualCatalog)catalogContext.GetCatalog("TravelCareVirtualCatalog","en-
>
|
|
|
|
|