Using CommerceBuilder DLL

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
zenonpham
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 29
Joined: Fri Dec 14, 2007 9:56 am

Using CommerceBuilder DLL

Post by zenonpham » Wed Feb 13, 2008 9:40 am

Hello All,

I'm in the process of writing a .NET 2.0 web service to make the AbleCommerce cart functions available to other software in our organization.

Does anyone know the basics of how to set this up? We're using VS2005 with SQL Server 2005 in the back.

herchenx
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Mon Sep 24, 2007 4:10 pm
Location: Fort Collins, CO

Post by herchenx » Thu Feb 14, 2008 10:35 am

I am relatively new to AC, but in general in ASP.NET you will need to write a custom service (asmx) and write custom methods that do whatever you need to expose the functionality from the cart.

Another option would be to write a service class (pure C#) then install FluorineFX on your server and implement it in your class. Normally this is used to share objects with Adobe Flex but it also another approach to a service layer that you could use.

To create a simple web service, just add a new item to the site, select "Web Service" as the type, and you are off and running.

User avatar
zenonpham
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 29
Joined: Fri Dec 14, 2007 9:56 am

Post by zenonpham » Thu Feb 14, 2008 2:25 pm

Thanks herchenx,

I just re-read my question and realized that I didn't say what I meant. I've done Web Services before. The real question is how to incorporate the AbleCommerce dll into the Web Service.

I'm able to add their dll to the service but something's missing. When I run the service, it gives me the following error when the service code refers to CommerceBuilder:

"CommerceBuilder.Configuration.ConfigurationException: AbleCommerceHttpModule does not appear to be configured."

Have you (or anyone else) seen this? I must be missing something in the setup somewhere, but I'm not sure where at this point.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Post by Logan Rhodehamel » Mon Feb 25, 2008 1:04 pm

The CommerceBuilder assemblies are closely linked with the web application and it will be difficult for you to create a stand-alone service that references them. The particular error you are experiencing is because the web.config of your web service does not have all of the appropriate settings. However even if that is corrected other problems will arise.

To add web services to AbleCommerce, it's necessary to make the service part of the AbleCommerce install itself. Go to the AbleCommerce installation and load it as a web project into VS.Net. Then add a web service item to the project.

I tried this just now and made a simple service to get a product name given the ID.

Code: Select all

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using CommerceBuilder.Products;

/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service1 : System.Web.Services.WebService {

    public Service1 () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string GetProductName(int productId)
    {
        Product p = ProductDataSource.Load(productId);
        if (p != null) return p.Name;
        return string.Empty;
    }
}
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

User avatar
zenonpham
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 29
Joined: Fri Dec 14, 2007 9:56 am

The answer

Post by zenonpham » Tue Feb 26, 2008 8:57 am

Thanks Logan. I think I've tried every approach besides that one. This is exactly what I needed. Thanks again.

Post Reply