Umesh Bhatt

I am trying to use the following Order Agent API code to create the OrderManagementContext object

OrderServiceAgent orderService = new OrderServiceAgent(@"http://localhost:8080/CatalogWebService/CatalogWebService.asmx");
orderService.Credentials = System.Net.CredentialCache.DefaultCredentials;

OrderManagementContext orderManagemntCtxt = OrderManagementContext.Create(orderService);

However, I am getting the following exception during the last line (creating orderManagemntCtxt );

Value cannot be null. Parameter name: format

at System.String.Format(IFormatProvider provider, String format, Object[] args) at Microsoft.CommerceServer.Orders.OrderManagementContext..ctor(OrderServiceAgent agent)

at Microsoft.CommerceServer.Orders.OrderManagementContext.Create(OrderServiceAgent agent) at CS2007WebParts.ProductCatalogDisplay.Render(HtmlTextWriter writer)

in C:\Commerce Server\Commerce Server SharePoint Integration Files\CS2007WebParts\CS2007WebParts\ProductCatalogDisplay.cs:line 72

I have confirmed that the web service URL is working fine.

I would really appreciate any help on this one.

Re: Commerce Server 2007 Error in Order Agent Constructor

J-P Soulieres - CS Product Team

This is probably way too late to help you out, but in case some people are reading this thread.

You need to supply the Order Web Service Url to the Order Service Agent. In your code, you set the Catalog Web Service Url. Probably a copy/paste mistake...

OrderServiceAgent orderService = new OrderServiceAgent(@"http://localhost:8080/CatalogWebService/CatalogWebService.asmx");

Should be:

OrderServiceAgent orderService = new OrderServiceAgent(@"http://localhost:8080/OrdersWebService/OrdersWebService.asmx");