KevinBurton

I have the following two lines. But, the allowedStatusList is always null. Anyone know how I might get this call to return something Thank you.

OrderContext orderContext = OrderContext.Create("CSharpSite");

DataSet allowedStatusList = orderContext.GetAllowedStatus();



Re: Commerce Server 2007 GetAllowedStatus returning null?

Agha Asif Raza

The GetAllowedStatus method loads data from two tables named 'AllowedStatus' and 'StatusManager' of transactionconfig database. You should check these two tables whether they contain any data or not. I suspect the tables would be empty which is why you are getting a null returned by the method.

Consult the CS2007 documentation to know more about the GetAllowedStatus method:

http://msdn2.microsoft.com/en-us/library/microsoft.commerceserver.runtime.orders.ordercontext.getallowedstatus.aspx

Regards,

Agha





Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Agha Asif Raza wrote:

The GetAllowedStatus method loads data from two tables named 'AllowedStatus' and 'StatusManager' of transactionconfig database. You should check these two tables whether they contain any data or not. I suspect the tables would be empty which is why you are getting a null returned by the method.

Consult the CS2007 documentation to know more about the GetAllowedStatus method:

http://msdn2.microsoft.com/en-us/library/microsoft.commerceserver.runtime.orders.ordercontext.getallowedstatus.aspx

Regards,

Agha

Thank you. I double checked and those tables are present and non-empty. The method is still returning a null DataSet.





Re: Commerce Server 2007 GetAllowedStatus returning null?

Max Akbar - MSFT

Under the web.config is honorStatus set to true

-Max






Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Max Akbar - MSFT wrote:

Under the web.config is honorStatus set to true

-Max

I am using an application configuration. Think of it like a console application. But more direct answer is that there isn't a configuration in app.config for honorStatus. Should it be there I am not sure where and in what context to set "honorStatus". Would you mind sending me a configuration example that shows context. Thank you.

Kevin





Re: Commerce Server 2007 GetAllowedStatus returning null?

Joseph Johnson

Kevin,

If you use an OrderManagementContext instead of an OrderContext, does this work correctly

Code Snippet

OrderServiceAgent agent = new OrderServiceAgent(http://localhost/OrdersWebService/OrdersWebService.asmx);

OrderManagementContext context = OrderManagementContext.Create(agent);

DataSet ds = context.GetAllowedStatus();

This will go through your web service tier and pull the allowed status codes from there, which might work for what you're doing. I'm not sure if adding that property to app.config will actually work, but Max can give you a better idea.






Re: Commerce Server 2007 GetAllowedStatus returning null?

Max Akbar - MSFT

If you are creating a console app then copy the web.config values on the orders tag into the app.config, that should fix your issue.

-Max






Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Max Akbar - MSFT wrote:

If you are creating a console app then copy the web.config values on the orders tag into the app.config, that should fix your issue.

-Max

Copy web.config from where I don't have a web.config.





Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Joseph Johnson wrote:

Kevin,

If you use an OrderManagementContext instead of an OrderContext, does this work correctly

Code Snippet

OrderServiceAgent agent = new OrderServiceAgent(http://localhost/OrdersWebService/OrdersWebService.asmx);

OrderManagementContext context = OrderManagementContext.Create(agent);

DataSet ds = context.GetAllowedStatus();

This will go through your web service tier and pull the allowed status codes from there, which might work for what you're doing. I'm not sure if adding that property to app.config will actually work, but Max can give you a better idea.

I tried OrderManagementContext and it also returned a null data set.

(I have had a little problem "signing in" so that is the reason for the delay. Thank you for your continued interest)





Re: Commerce Server 2007 GetAllowedStatus returning null?

Max Akbar - MSFT

I take it that you must have a site, right If so this site will have a web.config. You need to copy the values in the web.config to app.config. The values in the web.config for that site is the same as the values for the orders web service so either web.config should work.

-Max






Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Max Akbar - MSFT wrote:

I take it that you must have a site, right If so this site will have a web.config. You need to copy the values in the web.config to app.config. The values in the web.config for that site is the same as the values for the orders web service so either web.config should work.

-Max

Now I get the following error. I did not get this exception when initializing the context without the additional configuration entries.

InitHandlers.ServiceConnectionException: The Order Web Service "CSharpSite" is currently unavailable. The Web Service might be experiencing technical difficulties, or you may need to adjust your connection settings. ---> Microsoft.CommerceServer.Runtime.Orders.MappingException: Error initializing Schema mapping. Details: Error G0002 - Storage mapping file D:\Program Files (x86)\BsiServices\ServiceHost\OrderObjectMappings.xml cannot be found

at Microsoft.CommerceServer.Orders.OrderServices.CreateServerImpl(OrderSiteAgent agent)

at Microsoft.CommerceServer.Orders.OrderManagementContext.Create(OrderSiteAgent agent)

at





Re: Commerce Server 2007 GetAllowedStatus returning null?

Max Akbar - MSFT

To create an OrderManagementContext that accesses the Orders System in-proc

1. Create a new project in Visual Studio (console app).
2. Add the following references:
Microsoft.CommerceServer.CrossTierTypes
Microsoft.CommerceServer.Orders.CrossTierTypes
Microsoft.CommerceServer.Runtime
3. Add using directives for the following namespaces:
using Microsoft.CommerceServer;
using Microsoft.CommerceServer.Orders;
using System.Data;
4. Crete a new configuration file "app.config"
5. Open the web.config and copy the following text into app.config (code can be found under Code Snippet).

6. From Visual Studio add two existing files to your project OrderPipelineMappings.xml and OrderObjectMappings.xml. These files can be found under C:\Inetpub\wwwroot\CSharpSite.
7. From Visual Studio solution explorer select the OrderPipelineMappings.xml then in properties window select "Copy to output directory" and set it to "Copy always". Do the same for OrderObjectMappings.xml.
8. Create a new OrderSiteAgent object and pass the name of the site that the agent should connect to.
9. Create a new OrderManagementContext object and pass the OrderSiteAgent object to the Create method of the OrderManagementContext object.


Code Snippet

Config Section:

================================================================================================================

<configSections>
<sectionGroup name="CommerceServer">
<section name="application" type="Microsoft.CommerceServer.Runtime.Configuration.CommerceApplicationSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section name="orders" type="Microsoft.CommerceServer.Runtime.Configuration.CommerceOrdersSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</sectionGroup>
</configSections>
<CommerceServer>
<orders honorStatus="true" newOrderStatus="NewOrder" sqlCommandTimeoutSeconds="60" sqlLongRunningCommandTimeoutSeconds="28800">
<addressMap>
<profileDefinition name="Address"/>
<property from="GeneralInfo.address_id" to="OrderAddressId"/>
<property from="GeneralInfo.first_name" to="FirstName"/>
<property from="GeneralInfo.last_name" to="LastName"/>
<property from="GeneralInfo.address_line1" to="Line1"/>
<property from="GeneralInfo.address_line2" to="Line2"/>
<property from="GeneralInfo.city" to="City"/>
<property from="GeneralInfo.region_code" to="RegionCode"/>
<property from="GeneralInfo.postal_code" to="PostalCode"/>
<property from="GeneralInfo.country_name" to="CountryName"/>
<property from="GeneralInfo.region_name" to="State"/>
<property from="GeneralInfo.tel_number" to="DaytimePhoneNumber"/>
</addressMap>
<Types>
<Type Key="Basket" UserTypeName="Basket" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="PurchaseOrder" UserTypeName="PurchaseOrder" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="OrderTemplate" UserTypeName="OrderTemplate" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="OrderForm" UserTypeName="OrderForm" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="LineItem" UserTypeName="LineItem" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="Shipment" UserTypeName="Shipment" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="Payment" UserTypeName="Payment" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="CreditCardPayment" UserTypeName="CreditCardPayment" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="GiftCertificatePayment" UserTypeName="GiftCertificatePayment" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="PurchaseOrderPayment" UserTypeName="PurchaseOrderPayment" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="CashCardPayment" UserTypeName="CashCardPayment" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="OrderAddress" UserTypeName="OrderAddress" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="DiscountApplicationRecord" UserTypeName="DiscountApplicationRecord" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="ShippingDiscountRecord" UserTypeName="ShippingDiscountRecord" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<Type Key="PromoCodeRecord" UserTypeName="PromoCodeRecord" AssemblyType="GAC" NameSpace="Microsoft.CommerceServer.Runtime.Orders" Assembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</Types>
<Limits OrderFormsPerOrderGroup="5" PromoCodeRecordsPerOrderForm="10" PromoCodesPerOrderForm="10" LineItemsPerOrderForm="40" OrderTemplatesPerUser="10" PaymentsPerOrderForm="10" ShipmentsPerOrderForm="40" BasketsPerUser="15" OrderAddressesPerOrderGroup="10"/>
<MappingFiles PipelineMappingFilename="OrderPipelineMappings.xml" StorageMappingFilename="OrderObjectMappings.xml"/>
<SerializationBindings>
<SerializationBinding OldType="Microsoft.CommerceServer.Runtime.Orders.LineItem , Microsoft.CommerceServer.Runtime ,Version=6.0.1.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35" NewType="Microsoft.CommerceServer.Runtime.Orders.LineItem, Microsoft.CommerceServer.Runtime,Version=6.0.1.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</SerializationBindings>
</orders>
</CommerceServer>

================================================================================================================

Orders Context Code:

================================================================================================================

OrderSiteAgent ordersAgent = new OrderSiteAgent("CSharpSite");
OrderManagementContext orderManagementContext = OrderManagementContext.Create(ordersAgent);

DataSet allowedStatusList = orderManagementContext.GetAllowedStatus();

================================================================================================================

Let me know if you still have questions.

-Max






Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Thank you. This is definite progress. This works I have a simple console app and now I can get the allowed statuses. Before I incorporate this into our main code base I was wondering what all of this does besides allowing the GetAllowedStatus to return something other than null Does it change the column names of any of the tables, increase overhead, etc. Adding these two .xml files and significantly increasing the size of our .config file I would think has other side effects other making GetAllowedStatus to return other than null. This is such a large change I need to have some idea of what it is doing.



Re: Commerce Server 2007 GetAllowedStatus returning null?

Max Akbar - MSFT

The configuration values are well documented please read the following Web.Config Configuration Settings. If you still have questions post again.

-Max






Re: Commerce Server 2007 GetAllowedStatus returning null?

KevinBurton

Why do I need all of this configuration just to get GetAllowedStatus to return a non-null data set