Creating Web Services to work with the Business Data Catalog

The Business Data Catalog and Web Services – best practises

Web Services are a great way of connecting your Line of Business System with the Business Data Catalog. Unfortunately the business data catalog will work best when your web services are returning objects in a certain structure, and the web methods map directly to the BDC web methods.

First of all lets look at what type of return objects do not work well with BDC Meta Man.

Any object that is returned by your web method that does not have a pre-defined data structure to, BDC Meta Man will not be able to generate an application definition file for. Examples of these are datasets and XML documents. We cannot tell from the WSDL what the structure of the dataset will be, this would only be realized at run time. It’s generally not a good idea to return a dataset anyway as it is a .NET specific type.

How to build good web service methods for the BDC

For each type of BDC entity you want to create, it is ideal that you will have the necessary seperate web service methods. For example you may want have a customer entity so we would create our own customer object, and have three web service methods that return customer data in different ways.

public class Customer
// our customer properties defined…

public List<Customer> GetCustomers() – this implements our Finder method

public Customer GetCustomer(int customerId) – this implements our SpecificFinder method

public List<int> GetCustomerIds() – this implements our IdEnumerator method

These are web services that BDC Meta Man will easily be able to generate application definition files for, and that will work very nicely with the BDC. You can download and try out BDC Web Man which is a tool that will automatically generate web services from your database tables for you.

A few other BAD examples of web services that do not work well with the BDC.

– any web service where you need to pass in the type of object you get back
eg [WebMethod] ExecuteData(“Customers”);

– any web service where you need to pass in the method to execute
eg [WebMethod] Customers(“GetAllCustomers”);

Leave a comment