Hi
I would like some advice on how best to use web service proxy classes. Lets
say I have a web service with 3 methods to GetCustomer, DeleteCustomer and
UpdateCustomer. In my client code I might have a class that will call
GetCustomer and then depending on user input, I might want to DeleteCustomer
or UpdateCustomer. In my client code I will need an instance of a proxy
class for the web service I want to use and as I see it, there are 3 ways I
could use this proxy class.
a) Create a static class with a static instance of the web service proxy
and in my customer client class use the static instance of proxy in the
static class in my GetCustomer(), DeleteCustomer(), and UpdateCustomer()
methods.
b) Create a new private instance in my customer client class and re-use the
same private instance in my GetCustomer(), DeleteCustomer(),
andUpdateCustomer() methods.
c) In my customer client class, create a new local instance of the proxy in
each of the methods so GetCustomer() would instantiate a new instance of the
web service proxy, DeleteCustomer() would instantiate a new instance of the
web service proxy and so would UpdateCustomer().
What's the preferred way?
My second question is this: If I write a web service application that is
capable of retrieving/updating all sorts of data such as customers,
products, orders, stock etc should I create multiple web services, one for
each type of data, or is it better to create one large web service with all
the methods for creating and updating all the various data types (I will be
creating seperate class files for all the data access methods so the method
body of each web method will only be 1 or 2 lines)?
Your comments will be most welcome.
Thanks!
John