Skip to main content

Cloud

Business Connectivity Services: Multiple Bindings from a Single Windows Communication Foundation Service

A couple of weeks ago, I thought I’d be clever, or at least act with forethought, and create the Windows Communication Foundation (WCF) service I was working on as four separate interfaces all implemented by the same class.The interfaces would be segmented out by the types that they returned.This would make understanding the code easier down the road and it seemed like a good idea at the time.

However, the goal of this service was to be plugged into Business Connectivity Services (BCS) in SharePoint 2010.It turns out that BCS interacts with WCF services through the SOAP protocol instead of native WCF.In other words, it treats the service as a basic SOAP web service instead of a more capable WCF service.What this means is that multiple interface bindings from the same service, which is what I was doing, do not work correctly in BCS.

Instead, an error is thrown and buried in the SharePoint Front End Web Server log in the SharePoint 2010 hive stating that BCS is unable to unambiguously determine the endpoint of the desired method.However, the BCS model passes validation and initial content type creation.For the most part, if your model validates, it’s likely that it’s semantically correct.

Such was not the case here.Instead, BCS doesn’t read the WSDL, which plainly states that there are multiple bindings for the service.BCS will attempt every method defined for the service with every Line of Business (LOB) instance in the model.

Don’t mistake this for having more than one implementation of the same service.This is entirely possible by creating separate LOB instances to match multiple endpoints.However, each of these endpoints must implement all specified methods.What I was trying to do was implement specific methods for each binding.This is possible by creating multiple LOB system models, but that breaks any associations that may exist between types within the service.

Unfortunately, there’s only one solution: Consolidate all of your service methods into one large interface, which can be messy, but will work every time.Because of how BCS handles WCF you can’t even explicitly create multiple bindings in the web.config of the service.

In summary, you can use multiple endpoints, but you can’t use multiple bindings that don’t all implement all functionality.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Andrew Schwenker

Andrew Schwenker is a Sr. Technical Consultant within Perficient’s Microsoft National Business Unit East's SharePoint practice. Andrew has nearly 2 years of experience in consulting and has participated in projects that have touched nearly every aspect of SharePoint 2010. Andrew earned his Bachelor’s degree in Computer Science as well as Master’s degrees in Computer Science and Information Systems from Indiana University. He’s interested in creating winning solutions to generate business innovation using SharePoint. Prior to starting at Perficient, Andrew completed internships with General Electric, ExactTarget, and Great American Financial Resources. During his studies, he actively participated in Alpha Phi Omega National Service Fraternity and competed in the first annual Cluster Challenge at SC07 in Reno, NV. Andrew was a part of the dynamic PointBridge team that was acquired by Perficient.

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram