Installation and API

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
hbcondo
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Tue Jan 20, 2009 3:52 pm

Installation and API

Post by hbcondo » Tue Jan 20, 2009 4:21 pm

Hi, I have installed AbleCommerce 7 as a subdirectory of my primary website and made it a virtual directory. The site runs great but what I would like is to utilize the AbleCommerce API on my primary website to display product info, etc. Is this possible?

Perhaps another way to ask this question is how can an application outside of AbleCommerce consume its API? Any information on this is greatly appreciated. Thanks.

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Installation and API

Post by nickc » Tue Jan 20, 2009 6:12 pm

I believe Able requires a valid license to be present in the context where API calls are made - so probably not.
You could make a webservice inside Able that exposes specific methods/properties to your other app - not the most elegant solution, but would work.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Installation and API

Post by AbleMods » Tue Jan 20, 2009 7:04 pm

Nick is correct.

When your AC7 install is licensed, it implements an HTTP handler that redirects all requests to the domain name assigned to the license.

What you might (depending on your primary site design) be able to do is the opposite. Integrate your primary as a sub-site with AC7 being the parent. As long as they're all part of the same single .Net app, you'd have access to everything in the CommerceBuilder API.

Depending on your primary site design, this could be a really swell idea or a really bad one :)

If that's a no-no, Nick has the right idea with the webservice. Expose what you need to keep it simple and go from there. Either way, sounds like you've got your work cut out for you. Getting two completely different .Net apps to play nice can be quite the challenge.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

hbcondo
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Tue Jan 20, 2009 3:52 pm

Re: Installation and API

Post by hbcondo » Tue Jan 20, 2009 10:09 pm

Thank you for your advice. The CommerceBuilder API is so extensive I want to use it like it was intended to be used. What about adding the CommerceBuilder assemblies (.dll files) to the root / parent website's Bin folder?

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Installation and API

Post by AbleMods » Tue Jan 20, 2009 10:27 pm

So long as you're ok with the HTTP handlers redirecting to the domain keyed into the license, I believe it would work. You'd have to copy the DLL files to the root Bin folder. Plus there are a TON of web.config specifics for AC7 so those'll have to be merged with your existing app web.config.

But don't quote me on that - what you're describing extends far beyond my experience. I do recall another post asking a similar question some time ago - might prove fruitful to do a little searching and see what it turns up.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

hbcondo
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Tue Jan 20, 2009 3:52 pm

Re: Installation and API

Post by hbcondo » Wed Jan 21, 2009 12:18 am

Yes, this appears to have been an active topic of discussion a few months back. I thought my situation was unique but it appears there are a few others out there that would like to run AbleCommerce "outside" of their existing website. Below is how I am currently doing it which also allows the primary website to consume the CommerceBuilder API:

IIS to-dos:
- Make the folder that contains the AbleCommerce code a virtual directory (must have its own application state)

Parent web project to-dos:
- Add references to the CommerceBuilder.dll and CommerceBuilder.Services.dll Bin folder
- Add CommerceBuilder.lic as an existing item to App_Data folder

Parent web.config to-dos:
- Add a database connection entry to the AbleCommerce database
- Add a httpModules entry for AbleCommerceHttpModule
- Add anonymousIdentification tag; add the attribute "domain" and set the value equal to your domain (ex. localhost).
- Add location tag to prevent web.config inheritence from parent to child

After the above steps were performed, I got full intellisense in Visual Studio for the CommerceBuilder API. So far, I have successfully pulled from the Catalog and Products namespaces!

* Note that I only intend to perform basic read-only operations and additional references may have to be added to perform additional functionality.
Last edited by hbcondo on Wed Apr 01, 2009 12:45 pm, edited 1 time in total.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Installation and API

Post by AbleMods » Wed Jan 21, 2009 8:34 am

Fantastic info - Thanks so much for taking the time to share with the community!
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: Installation and API

Post by krissato » Mon Mar 30, 2009 10:59 am

Thank you for your post, hbcondo! I am trying to do the same thing, and it is almost working...

http://localhost/ is my parent web site
http://localhost/ac/ is the AbleCommerce web site

I am able to launch both URLs fine, until I add a httpModules entry for AbleCommerceHttpModule in the parent site's web.config. When I try to go to http://localhost/ I now get the

"There is something wrong with your AbleCommerce license key." error screen.

I do have a copy of the CommerceBuilder.lic file in the parent site's App_Data folder.

Any ideas? Is there anything different in the way you have your virtual directory for AC set up?

Thanks again!

hbcondo
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Tue Jan 20, 2009 3:52 pm

Re: Installation and API

Post by hbcondo » Mon Mar 30, 2009 11:53 am

krissato wrote:Thank you for your post, hbcondo! I am trying to do the same thing, and it is almost working...

http://localhost/ is my parent web site
http://localhost/ac/ is the AbleCommerce web site

I am able to launch both URLs fine, until I add a httpModules entry for AbleCommerceHttpModule in the parent site's web.config. When I try to go to http://localhost/ I now get the

"There is something wrong with your AbleCommerce license key." error screen.

I do have a copy of the CommerceBuilder.lic file in the parent site's App_Data folder.

Any ideas? Is there anything different in the way you have your virtual directory for AC set up?

Thanks again!
It is to my understanding that the license key includes information about the directory the store is running under. Due to this, try the following steps:

1. If you don't already have one, create an App_Date folder in the root of your website and copy the .lic from from the store's App_date directory to here
2. Copy the install directory from the store to the root website
3. Access the updatekey.aspx web page using a browser
4. Enter your license key here and now your root website should be able to use the AbleCommerce assemblies

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: Installation and API

Post by krissato » Mon Mar 30, 2009 4:14 pm

I was able to update the license key for my parent site - Thank You!!!

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: Installation and API

Post by krissato » Tue Mar 31, 2009 12:09 pm

I now have my Sitecore (CMS) site integrated with AbleCommerce working on my local machine - I'm very happy with that!

However, when I run the integrated site from our web server (IIS v6, Windows 2003), I am unable to log in to the CMS system. If I remove the httpModules entry for AbleCommerceHttpModule from the parent site's web.config, the CMS login works as expected.

I have included a log from the Event Viewer showing a failed login to the CMS below. Any ideas why the AbleCommerceHttpModule would be interfering with the CMS credential verification? It is also curious that it works fine on my local machine, but not on the server. Thanks in advance for any insights you might have!

Event code: 4006
Event message: Membership credential verification failed.
Event time: 3/31/2009 9:37:09 AM
Event time (UTC): 3/31/2009 4:37:09 PM
Event ID: 32a2e66716c84d08a8c5c0b898bc3ef2
Event sequence: 83
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/2/Root-1-128829904207631161
Trust level: Full
Application Virtual Path: /
Application Path: D:\Inetpub\wwwroot\AlfredSC\WebSite\
Machine name: ALFREDWEBDEV02

Process information:
Process ID: 2940
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL: http://sitecoredev.alfred.com/sitecore/ ... sc_lang=en
Request path: /sitecore/login/default.aspx
User host address: 192.168.210.254
User: sitecore\Anonymous
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Name to authenticate: sitecore\admin

Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: Installation and API

Post by krissato » Tue Mar 31, 2009 4:14 pm

Correction - the login does not work on my local machine, either. I must have tested the login previous to adding the httpModule.

hbcondo
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Tue Jan 20, 2009 3:52 pm

Re: Installation and API

Post by hbcondo » Tue Mar 31, 2009 4:42 pm

krissato wrote:Event message: Membership credential verification failed.
I haven't encountered this error but I did a quick Google search for the error "Membership credential verification failed" and a lot of results showed up so it appears to be a common issue. The web.config file of the store uses rolemanager and providers. Perhaps adding those to your site's web.config will help?

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: Installation and API

Post by krissato » Wed Apr 01, 2009 10:09 am

Thanks for the tip... the parent web.config did have the applicationName of the providers set properly. The AbleCommerce web.config did not, so I set the AC web.config providers to match the parent web.config applicationName. This did not fix my problem. After more extensive testing, I see that I only rarely get the Event code error. I mostly do not get any feedback as to why I am not progressing past the login screen.

I am wondering what the AbleCommerceHttpModule could be doing to block the login?

hbcondo
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Tue Jan 20, 2009 3:52 pm

Re: Installation and API

Post by hbcondo » Wed Apr 01, 2009 12:47 pm

FYI, I updated my original response to include an update to the anonymousIdentification tag to include the domain attribute. I was having some issues with the Checkout functionality and adding the domain attribute fixed that.

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: Installation and API

Post by krissato » Wed Apr 01, 2009 7:00 pm

Thanks for the update!

Post Reply