MASHUP: SharePoint 2010 BCS + WCF + SAP
Recently went through the process of pulling data from SAP into SharePoint 2010 via BCS and WCF. Very powerful stuff but ooooh, the pain, THE PAIN! So I thought I’d share my experience to mitigate the unpleasantries you may experience. To sum up the basic steps and design:
- Develop the .NET-to-BAPI RFC using the SAP Connector 2.0 in VS 2003/XP VM
- Migrate the entire project to VS 2010 in Windows Server 2008 R2
- Add logic (DataTable) and wrap in WCF Service
- Deploy WCF to IIS 7.0
- In SharePoint Designer 2010, configure an External Content Type to consume the WCF service
- Configure content type in a SharePoint 2010 BCS List
Admittingly, the SAP process was the most difficult (and sinister!) Lots of help was available in the SharePoint community however. Enjoy!
1. Setup the XP VM
- Required because VS2003 installs failed in Windows Server 2008
- Install VS 2003
- Install SAP .NET Connector 2.0 – this is the real culprit. This connector provides the BAPI explorer ONLY in VS2003. SAP is FINALLY working on the 3.0 connector which will hopefully integrate into a VS2010.
By the way, you can opt to use the BizTalk Adapter Pack and forgo the VS2003/XP steps. The adapter pack is designed to be used with WCF. However, at the time of this writing, Microsoft recommends a suggested retail price of $5000+ per CPU. Another cheaper alternative is ERPConnect by Theobald Software. ERPConnect integrates at the assembly level – therefore it can be integrated into any .NET platform – ASP.NET, WinForms and not just WCF.
2. Setup VS2003 – follow this example for developing a BAPI interface. Stuff you’ll need from your SAP gurus.
- System Number
- App Server host
3. VS 2010 Setup (Separate VM)
- Recommend NOT using XP 32bit for VS2010. Problems with GUI in MY VM.
- After setting up the BAPI function calls in VS2003, copy the entire project to VS2010.
- If in a separate VM, install SAP GUI to ensure dlls are available for the connector.
- Create a VS2010 WCF Library Project – Choose .NET 3.5!!
- Import the VS2003 project as an existing project. Perform the upgrade conversion.
- Add a reference to the WCF Library project for the:
- Your custom developed SAP dll from the new converted VS2003 project.
7. Follow this blog for setting up/developing/deploying your WCF to IIS.
- Using Process Explorer, I determined librfc32.dll needs to be in the environment variable PATH. You can get this from SAP GUI or if you’re brave, the SAP Market Place (developer purgatory). I only mention it because I’m sure you don’t want to install SAP GUI on a production server. Also, for development in 64bit environments, you should install the 64bit librfc32.dll in the Windows\System32 folder and the 32bit librfc32.dll in the Windows\SysWow64 folder. Here’s a good link on finding the librfc32.dll in SAP Market Place.
- Install SAP.Connector.dll and SAP.Connector.Rfc.dll in the GAC.
- Enable 32 bit Web App compatibility on the WCF App Pool (located under Advanced Settings).
- Ensure the 32 bit Web App compatibility is DISABLED for ALL SharePoint 2010 web apps
- Ensure the .NET 4.0 ISAPI filter is removed from all of your existing SharePoint 2010 web apps.
8. Follow this blog for setting up and connecting to your BCS via an External Content Type in SharePoint Designer 2010.
- PAY ATTENTION to your base address in your web.config. It needs to match the URL you use in when connecting via SD.
- PAY ATTENTION to connection option of using METADATA EXCHANGE. Remember the ”/mex” and to choose “Metadata Exchange” for the Metadata Connection Mode.
- URL WEIRDNESS: Did I already mention to pay attention to your base address?? In the web.config on my PRODUCTION server, I specified http://myservername:8888 for the base address. However, SharePoint Designer could not find the end point until I used a fully qualified domain name: http://myservername.mydomain.com:8888. Note that I did NOT have to use the FQDN in my local VM for testing!
- Also, I noticed the BCS Data List does have paging built in. HOWEVER, it does a full pull from the source for each page. That could get EXPENSIVE if you have a lot of data.
1. Read article comparing WCF to old way of doing Web Services.
- It’s DataContractSerializer is 10% faster using the XMLSerializer
- Versioning tolerance (DataContractSerializer only)
– Missing members (deserializes defaults – null, 0 and etc)
– Adding fields does not break interface
- Seemless support for other bindings: MSMQ, TCP, Named Pipes, Dual HTTP and etc
- Asynchronous call (or callback) support
- Takes advantage of Windows Activation Services
2. Microsoft provides a great tutorial here.
3. Use VS2010 “WCF Library” projects to enable portability
4. Use a separate App Pool for WCF Services
5. Use a separate virtual directory OUTSIDE of SharePoint
– web.config modifications
– patching of SharePoint
6. Also a good article on deployment best practices
7. WCF supports WS-I Basic Profile 1.1 via the BasicHttpBinding class.