Random errors on creating order through API

Discussions related to custom development with Select.
Hadi Chemaly

Re: Random errors on creating order through API

Post by Hadi Chemaly »

Are you using an OrderCreationSpec when creating your order or are you simply doing

Code: Select all

using (IOrder order = ot.CreateOrder())
{
...
}
kqian
Posts: 68
Joined: Wed Feb 23, 2011 4:01 pm

Re: Random errors on creating order through API

Post by kqian »

Yes, I use OrderCreationSpec. With Single instance mode in our WCF, it runs much better now but still not 100%. So far I've got one failure as posted previously. Did the stack trace provide any helpful indicator what the problem might be? Is there other more reliable way to explicitly dispose the SoftPro objects after a call? Thanks.

Code: Select all

            var spec = new OrderCreationSpec()
            {
                BaseOrderNumber = orderNumber,
                Prefix = @"",
                Suffix = @"",
                OwningProfileID = owningProfileGuid
            };

            spec.Templates.Add(templateName);

            try
            {
                //Creating order object.
                using (var order = orderTracking.CreateOrder(spec))
                {
                    try
                    {
                            ...
                    }
                    finally
                    {
                        //always close the order - otherwise it will leave a lock!
                        orderTracking.CloseOrder(order);
                    }
                }
            }
            catch (Exception ex)
            {
                mErrorLogging.Log(...);
                throw;
            }
Randy Mellow

Re: Random errors on creating order through API

Post by Randy Mellow »

The stack trace leads me to believe that the problem occurred while integrating the template data. Specifically, creating one of the order contacts. Is the template you used to create this order used routinely to successfully create orders? From the code I've seen so far it doesn't look like you are doing anything out of the ordinary with regards to disposing the objects.
Post Reply