Wednesday, October 18, 2006

Integrating Microsoft Commerce Server 2007 and MOSS

I have just completed an interesting proof-of-concept project that showed how MOSS and Commerce Server can complement each other in provisioning an eCommerce site.

Traditionally, Commerce Server handles all commerce-type transactions, e.g. shopping carts, product catalogs, inventory, order management, etc.

MOSS picks up where Commerce Server leaves off by putting forward web content management (versioning of product information, approval workflows), some level of collaboration (e.g. product review sub-sites) and generally handling the overall branding and management of the portal.

Since both products leverage on ASP.NET 2.0, they integrate really nicely together. Kind of like building an eCommerce site on steroids :-)

The trickiest bit, which suprisingly turned out to be a really smooth ride, was how to get MOSS linked up to Commerce Server. For an integrated solution, we absolutely needed to call Commerce Server APIs from MOSS. To add an additional level of complexity to the problem, we were also required to authenticate users using Commerce Server's UpmMembershipProvider.

And before I forget what we went through, here's how it was done.

Getting MOSS to recognize Commerce Server's APIs
The first step was to merge the configuration files of both the Commerce Server and SharePoint site. Since we were using MOSS to manage the branding of the site, it made sense to make it the customer facing app and modify it's web.config file to include Commerce Server's configurations. These are the parts that need to be copied over (I'm going to use square brackets instead of angle brackets here as Blogger does not handle angles very well):

1. Everything in the [sectionGroup name="CommerceServer]" tag
2. Everything in the ["CommerceServer"] tag
3. All the commerce server specific handlers in the [httpModules] tag - Includes "CommerceApplication" all the way down to "CommerceDataWarehouseAuthenticationModule"
4. All the commerce server [assemblies] listed in the [compilation] tag.

Next, we copied all the CommerceServer library files to the bin directory. List of files included:
a. CommerceMessageManager.dll
b. The "de-DE", "en-us", "fr-fr", ja-JP" sub folders.

Copy also the following files from the root directory of the Commerce Server site to the root directory of the SharePoint site:
a. csapp.ini
b. OrderObjectMappings.xml
c. OrderPipelineMappings.xml
d. as well as the entire "pipelines" folder.

And voila! With that, we could use the Commerce Server API from any page within MOSS. E.g. CommerceContext.Current should now return a valid instance.

Implementing the UpmMembershipProvider on a MOSS site
To capitalize on Commerce Server's Profiler, we needed to implement the UpmMembershipProvider on the MOSS site. This part of the setup has been nicely documented in this newsgroup post by Amy.

However, it's probably worthwhile to note that if you're using the email address as the loginID, you could distill it down to the following steps:

1. Add the [membership] tag, for example: (note, I've replaced angle brakets with square brackets).

[membership defaultProvider="UpmMembershipProvider"]
[providers]
[clear /]
[add applicationName="MyAppName" enablePasswordRetrieval="false" enablePasswordReset="true" logonNameProperty="GeneralInfo.email_address" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" enableCreateDate="true" enableEmailAddress="true" enableLastLoginDate="true" profileDefinition="UserObject" passwordFormat="Hashed" name="UpmMembershipProvider" type="Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider" /]
[/providers]
[/membership]

2. Uncomment, or add (if it's not already present) the [profiles] tag in the [CommerceServer] section of the web.config file.

3. And before you can add the first administrator to the site. You will need to complete all the steps above (yes, even the part about merging the web.config file) on the SharePoint Central Administration website as well.

4. Finally, use SharePoint Central Administration to apply forms authentication to the site in question and specify "UpmMembershipProvider" as the membership provider.

The biggest headaches that arose from the applying the UpmMembershipProvider were typos and missing commerce server tags. Make a tiny mistake and you will find that the login form gets stuck in a loop, regardless of the userid and password entered. When I forgot to add the commerce server [assemblies] to the web.config file, it took me 2 agonizing hours before I realised what was wrong. Erk.

The best part is, once its setup, integrating Commerce Server and MOSS is a breeze. After the initial setup is done, you can easily create SharePoint web parts and user controls using Commerce Server's API to build some really neat features.

Food for thought: It would really be nice to have an "Enable as Commerce Site" button in SharePoint Designer like the "Enable as CMS site" button we had in VS.NET for MCMS. That will be really neat!

23 Comments:

At 7:35 PM, Anonymous Anonymous said...

Excellent Work..

By the way, any idea of whats the final release date for MOSS 2007?

 
At 7:59 PM, Anonymous Anonymous said...

Very interesting!! I assume that you have CS and MOSS installed on the same machine since you don't mentioned anything about that. Any idea about how to use the UpmMembershipProvider in MOSS if MOSS and CS are implemented on separate servers?

 
At 1:59 AM, Anonymous Anonymous said...

Any tutorial or example for new comer in
Sharepoint and Commerce server?

Does window sharepoint service V3 support this feature.

 
At 11:39 PM, Anonymous Anonymous said...

Did you move down the path of integrating MOSS search with the product catalog with CS 2007?

 
At 11:08 AM, Blogger Mei Ying said...

Yes, we did - the whole works.

Basically, the idea behind the integration that we did was to have MOSS contain working versions of the product catalog. It was pretty cool as MOSS provides check-in/check-out, versioning, data checks, and more importantly, a web front to enter product details.

At the end of the day, the final version of the catalog info was published to Commerce Server using a workflow action.

So MOSS was used to draft the content and the final copy gets published to Commerce Server. It's a really neat combo!

 
At 5:26 PM, Anonymous Anonymous said...

Is their is any live webcast is available for this which will explain us from scratch how to go for this?

 
At 6:45 PM, Anonymous Anonymous said...

Interesting idea to use SharePoint versioning for CS products. Did you make a feature for the products, or is it more complex than that?

 
At 11:29 AM, Anonymous Anonymous said...

Hi Mei Ying,
I have followed your step for lotus notes search its working great. My problem is i want to do access control in lotus notes search. Currently the search displays all results. How do i display the document only the user has rights in lotus notes. I installed ADSync tool which comes with Domino Admin client and synchronized AD to Lotus notes. But still getting all results.

 
At 2:51 PM, Blogger srikanth said...

Hi Mei Ying,
I am using Commerce Server 2002.My understanding is that the CMS 2002/BizDesk platform has a limitation of 10k organizations in organization object of the Profiles Database. If Yes, how this limitation can be removed. Thank you.

 
At 10:34 PM, Anonymous Anonymous said...

Hello Mei Ying,
Excellent, I've got the whole thing up and running now, thank you! Now we're down to the part where we'de like to actually create orders from MOSS and include documents from MOSS in the orders, would you have any examples to get us started? Many thanks.

 
At 4:12 AM, Anonymous Anonymous said...

Hi Mei, do you think that the integration you have tested could works with Commerce Server 2002 instead of Commerce Server 2007?

 
At 5:22 PM, Blogger Mei Ying said...

I've not tried that. though I would think that CS 2002 and CS 2007 are completely different kettled of fish. Ultimately, what we want is to be able to call CS's APIs from SharePoint. So you would probably have to re-merge the web.config files of CS 2002 and SharePoint.

 
At 11:23 PM, Anonymous Anonymous said...

Make a tiny mistake and you will find that the login form gets stuck in a loop, regardless of the userid and password entered

Arrrgh!! I'm stuck here :¬(
My Admin site can collect users from the Commerce Server Profiles. So, I set one of them up as the Admin for the Portal Site as described, but it just loops through. It doesn't even tell me the details are incorrect.

Mei Ying, do you have any ideas please? I'm desperate on this as I can't add anything to my Shopping Baskets because the CommerceContext.UserProfile is null

 
At 6:26 PM, Blogger Mei Ying said...

That is tricky. I may have the merged web.config file still in my VPC. I can send you the file and maybe you do do a quick comparison to see what's different.

 
At 12:13 AM, Anonymous Anonymous said...

Thanks for your help on that Mei Ying. Comparing the web.config files highlighted the problem straight away :¬)

 
At 6:11 PM, Blogger Tim Hustler said...

Hi Mei Ying

Do you know how to add users to a subsite of a CSAuthed Sharepoint Portal?

I can get WSS to access the CommerceServer Profiles and have written code to add users as they sign up to my site

However, some of the secure areas are SubSites of my main app and i need to add the CS users to the SharePoint side as well

Have you any ideas? I've tried using the WebServices and also the Sharepoint API's but they both fail on some kind of security issue and i'm not sure how to get around it :¬(

cheers

Tim Hustler (again :¬( )

 
At 5:35 PM, Blogger Tim Hustler said...

Hi Again Mei Ying

Just to let you know that i managed to work out how to add the Commerce Server users to the SharePoint groups after some trawling.

There is a little function the SPSecurity class called RunWithElevatedPrivileges that allows to run admin functions in super-user mode, much like the access righrs of the Central Admin Site can

I have a post about it on my blog http://timzblogyarr.blogspot.com/ if it's of any interest

Thanks for all your help on my issues as well Mei Ying. Your blog really helped us get our solution working as we wanted it. i'll be writing some blurb on MOSS/Commerce Server integration over the holidays and i'll be sure to link your blog posts when i do :¬)

Thanks Again

Tim Hustler

 
At 11:14 PM, Anonymous Anonymous said...

Hi Mei Ying,

I have the same problem with Tim. I'm in a continuous login loop, after it worked one time. The user is correctly authenticated (I can see the last logon field being updated in DB). If possible could I also have your web.config to see if I configured something wrong. Email: rslite_NOSPAM_ at _NOSPAM_gmail dot com_NOSPAM_

 
At 1:10 AM, Anonymous Anonymous said...

Hey Mei,
You are a life saviour. It seems I am looking for the exact things that you have mentioned in your blog. It was really great for me and my team.
However, I had some questions if you could answer them please:
1. Can we have commerce server 2007 and MOSS 2007 hosted on separate servers and still have the two guys talk to each other?

2. I want to create an online ordering web site. For this I have chosen MOSS2007 a=with the middleware as Commerce Server 2007. But being a beginner to MOSS & Commerce Server, I am not sure how to create transaction sites in MOSS 2007. Can you please share some insights into this (or some article you may have come across).

Thanks a lot for the help in advance.

Regards,
Arijit

 
At 11:13 AM, Blogger Mei Ying said...

We've done sites that have Commerce Server in the middleware. But the front end is a regular ASP.NET application. The thing to watch out for is performance. In this case, we used web services to connect to Commerce Server. It worked well with appropriate caching mechanisms in place.

 
At 11:10 PM, Blogger PB said...

Hi Mei Ying

We have to develop an online ordering application. The client is planning to use Commerce Server 2007 to use its catalog, order, etc and finally use Sharepoint 2007 as the front end.

I am kind of very unsure how we can MOSS give an advantage here.

In your blog here you have spoken of some nice integration points.

Will it be possible for you to share your POC code?

I am a novice & hence your help will be much appreciated!!

Thanks!!
Poonam

 
At 11:57 AM, Blogger drozzy said...

Hello,
Would you be kind enough to provide a rough time estimate of how long it took you to configure Sharepoint & Ms Commerce from the group up? (Including hardware, test, setup etc..)?

That would great. Thanks!

 
At 11:45 PM, Anonymous Anonymous said...

Hello,
Have you ever tried to integrate dotnetnuke (DNN) with commerce server 2007.
I could get the both working by writing some stored procedures and accessing the DNN database directly rather than having a proper integration like you did.
Would like to know your thoughts on that.

Thanks

 

Post a Comment

<< Home