Invoking pipelines using OrderPipeline.Execute()
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Invoking pipelines using OrderPipeline.Execute()

 
Post new topic   Reply to topic    Windows Server Forum Index -> Commerce Server
Author Message
techman
Guest





Posted: Thu Aug 18, 2005 4:52 pm    Post subject: Invoking pipelines using OrderPipeline.Execute() Reply with quote

Hi,
I am trying to invoke a pipeline using the OrderPipeline.Execute() method. I
am getting the following exception:

InvalidCastException: Specified cast is not valid.]
Microsoft.CommerceServer.Runtime.Pipelines.OrderPipeline.Execute(Object
order, Object context) +108

Is this a proper approach for invoking a pipeline? If so, can someone
provide me details about the arguments passed to this method, especially the
'context' argument?

Thanks
Back to top
Colin Bowern
Guest





Posted: Fri Aug 19, 2005 4:52 pm    Post subject: Re: Invoking pipelines using OrderPipeline.Execute() Reply with quote

Hi,

What sort of pipeline are you trying to execute? Are you executing inside
an ASP.NET application context? I use the following helper function to
execute pipelines against baskets as an example:

private void RunPipeline(string pipelineName)
{
PipelineInfo pipeInfo;
CommerceContext commerceContext = CommerceContext.Current;

pipeInfo = new PipelineInfo(pipelineName);

// Set pipeline object references
pipeInfo[PipelineFields.CatalogLanguage] =
Thread.CurrentThread.CurrentUICulture.Name;
pipeInfo.CatalogContext = commerceContext.CatalogSystem;
pipeInfo.ProfileContext = commerceContext.ProfileSystem;
pipeInfo.Language = Thread.CurrentThread.CurrentUICulture.Name;

// Attach the user profile to the pipeline.
pipeInfo.Profiles.Add("User", commerceContext.UserProfile);

// If it exists attach the targeting context profile.
if (commerceContext.TargetingSystem.TargetingContextProfile != null)
pipeInfo.Profiles.Add("TargetingContext",
commerceContext.TargetingSystem.TargetingContextProfile);

// Run pipeline
try
{
this.currentBasket.RunPipeline(pipeInfo);
}
catch (CommerceOrderSystemException ex)
{
ExceptionManager.Publish(ex);

if( (((SimpleList)this.orderForm[OrderFormFields.BasketErrors]).Count ==
0) &&
(((SimpleList)this.orderForm[OrderFormFields.PurchaseErrors]).Count ==
0) )
this.AddPurchaseError(StringResources.GetString(StringResourceKeys.Checkout_SystemError));
}

// Populate basket error collection
this.basketErrors.Clear();
foreach (object item in
(SimpleList)this.orderForm[OrderFormFields.BasketErrors])
this.AddBasketError((string)item);

// Populate purchase error collection
this.purchaseErrors.Clear();
foreach (object item in
(SimpleList)this.orderForm[OrderFormFields.PurchaseErrors])
this.AddPurchaseError((string)item);
}


"techman" <techman@discussions.microsoft.com> wrote in message
news:36401F79-8016-4252-BAB8-D017A739CB7E@microsoft.com...
Quote:
Hi,
I am trying to invoke a pipeline using the OrderPipeline.Execute() method.
I
am getting the following exception:

InvalidCastException: Specified cast is not valid.]
Microsoft.CommerceServer.Runtime.Pipelines.OrderPipeline.Execute(Object
order, Object context) +108

Is this a proper approach for invoking a pipeline? If so, can someone
provide me details about the arguments passed to this method, especially
the
'context' argument?

Thanks
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Commerce Server All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB