Cameron API New Order

Discussions related to custom development with Select.
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Cameron API New Order

Post by sanjay.mittal »

and Call Stack

"System.NullReferenceException: Object reference not set to an instance of an object. at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.EndApplyChanges(IAsyncResult ar) at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.ApplyChanges(IOrder order) at ERprjSVOtoSPS_CPut.ERmodSVOtoSPS_CPut.ProcessMessage(XmlDocument xmlDoc) in C:\SVO\SmartServiceBus\Adapters\SoftPro-Cameron\Softpro_CAdapter\ERprjSVOtoSPS_CPut\ERmodSVOtoSPS_CPut.vb:line 320"
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Cameron API New Order

Post by John Morris »

You haven't set any of the properties on the OrderCreationSpec. You have to at least fill in the Number property, as noted above.
John Morris
Sr. Software Architect
SoftPro
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Cameron API New Order

Post by sanjay.mittal »

Why do I have to assign an order number? I thought Select use the next number available to it.
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Cameron API New Order

Post by sanjay.mittal »

Also added the following line but it didn't help. Still got the same error.
spec.Number = "1234"
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Cameron API New Order

Post by John Morris »

Please copy your call stack here.
John Morris
Sr. Software Architect
SoftPro
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Cameron API New Order

Post by sanjay.mittal »

System.NullReferenceException: Object reference not set to an instance of an object. at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.EndApplyChanges(IAsyncResult ar) at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.ApplyChanges(IOrder order) at ERprjSVOtoSPS_CPut.ERmodSVOtoSPS_CPut.ProcessMessage(XmlDocument xmlDoc) in C:\SVO\SmartServiceBus\Adapters\SoftPro-Cameron\Softpro_CAdapter\ERprjSVOtoSPS_CPut\ERmodSVOtoSPS_CPut.vb:line 322
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Cameron API New Order

Post by John Morris »

Are there any error log entries on in the Windows Event Log?

Do you have any custom code running on the server side?
John Morris
Sr. Software Architect
SoftPro
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Cameron API New Order

Post by sanjay.mittal »

No we don't have any custom code on the server. Here is the error from the event log on the server.

An error occured on the service boundary.Error: Object reference not set to an instance of an object.
Stack Trace:
at SoftPro.OrderTracking.Client.Orders.OrderInfo..ctor(IServiceProvider site, IOrder order)
at SoftPro.OrderTracking.Persistence.Orders.OrdersDataContext.SoftPro.OrderTracking.Server.Orders.IOrdersDataContext.SaveOrder(IOrder order, Dictionary`2 attributes, Dictionary`2 attachments)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at SoftPro.PersistenceModel.StaleObjectStateExceptionAspect.SoftPro.ServerModel.Aspects.IAspect.Process(Action method)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at SoftPro.PersistenceModel.UniqueConstraintViolationAspect.SoftPro.ServerModel.Aspects.IAspect.Process(Action method)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at SoftPro.OrderTracking.Server.Orders.OrderStore.SaveOrder(IOrder order, Dictionary`2 attributes, Dictionary`2 attachments)
at SoftPro.OrderTracking.Server.Orders.OrderStore.ApplyChangesInternal(IOrder order, Boolean remoteCall, Dictionary`2 attributes, Dictionary`2& attachments)
at SoftPro.OrderTracking.Server.Orders.OrderStoreService.EndApplyChangesOrder(Guid taskID, Byte[] data, Dictionary`2 attributes)
at SyncInvokeEndApplyChangesOrder(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Claims:
Type=http://schemas.xmlsoap.org/ws/2005/05/i ... laims/hash, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... ssproperty, Resource=System.Byte[]
Type=http://schemas.xmlsoap.org/ws/2005/05/i ... identifier, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... t/identity, Resource=System.IdentityModel.Tokens.SamlNameIdentifierClaimResource
Type=http://schemas.xmlsoap.org/ws/2005/05/i ... identifier, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... ssproperty, Resource=System.IdentityModel.Tokens.SamlNameIdentifierClaimResource
Type=http://schemas.softprocorp.com/claims/sessionidentifier, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... ssproperty, Resource=437c67dc-b856-4487-82e4-bb9c372e0ae6
Type=http://schemas.softprocorp.com/claims/trusteeidentifier, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... ssproperty, Resource=08011c16-f370-417a-96df-72a501456141
Type=http://schemas.softprocorp.com/claims/d ... identifier, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... ssproperty, Resource=00000000-0000-0000-0000-000000000000
Type=http://schemas.softprocorp.com/claims/d ... identifier, Right=http://schemas.xmlsoap.org/ws/2005/05/i ... ssproperty, Resource=00000000-0000-0000-0000-000000000000
Action=http://schemas.softprocorp.com/select/o ... angesOrder, ReplyTo=http://schemas.microsoft.com/2005/12/Se ... /Anonymous, FaultTo=
john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

Re: Cameron API New Order

Post by john.morton »

Also, below is an updated version of the sample to generate and consume order numbers. When doing this, you'll also need to consider any prefix and/or suffix that might be required in your IOrderNumberGroup. These can then be provided, if needed, to the OrderCreationSpec along with the base Number.

We are working on a change for the final release that will allow you to more easily consume autogenerated order numbers for simple numbering schemes. The interfaces below will still be available in case more specific handling of order numbers is required.

Code: Select all

IOrderStore OrderStore = selectServer.GetService<IOrderStore>();
IOrderNumberingManager numberManager = selectServer.GetService<IOrderNumberingManager>();
IProfileManager profileManager = selectServer.GetService<IProfileManager>();
IOrderNumberingGroup group = numberManager.OrderNumberingGroups // get the order numbering manager associated with the user's active profile
								 .Search(new ClosestAncestorProfileSearch(profileManager.ActiveProfile))
								 .FirstOrDefault();

OrderCreationSpec spec;

using (TransactionScope scope = new TransactionScope())
{
	spec = new OrderCreationSpec()
	{
		Number = group.GetFormattedOrderNumber() // Gets a formatted version of the current number
	};

	group.GetNextNumber(null, null); // Consumes the current number, and increments
	scope.Complete();
}

using (IOrder order = OrderStore.NewOrder(spec))
{
	try
	{
		// Manipulate your new order here
		OrderStore.ApplyChanges(order);
	}
	finally
	{
		OrderStore.CloseOrder(order);
	}
}
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Cameron API New Order

Post by sanjay.mittal »

John,

You haven't declare the profile in the following statment. And .Serarch and .FirstOrDefault function is not availble with iProfileManager and iGroupManager

profile
.Search(new ClosestAncestorProfileSearch(profileManager.ActiveProfile))
.FirstOrDefault();

Also in the statement .Number = group.GetFormattedOrderNumber() , it is complaining that GetFormattedOrderNumber is not a member of the IOrderingNumberGroup.

I am kind of lost.
Post Reply