split a web service
-
We have a web service that is growing large enough that we wish to seperate logic. Ideally, we would have multiple code files on the server, and the service itself would still appear to be the same to consumers of it. If we were doing it in c++, we would simply split the implementation of our WebService class across several .cpp. Of course, we can't do that in C#. Any ideas or pointers to docs?
-
We have a web service that is growing large enough that we wish to seperate logic. Ideally, we would have multiple code files on the server, and the service itself would still appear to be the same to consumers of it. If we were doing it in c++, we would simply split the implementation of our WebService class across several .cpp. Of course, we can't do that in C#. Any ideas or pointers to docs?
Well, in VS2005/C#2.0 you have partial classes if thats what you mean (spreading the implimentation across files). But I don't see why you couldn't just have the webservice methods call methods in other classes. Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
-
Well, in VS2005/C#2.0 you have partial classes if thats what you mean (spreading the implimentation across files). But I don't see why you couldn't just have the webservice methods call methods in other classes. Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
Another part of it is wanting to group methods by thier function; e.g. multiple webservices in one. So from the WSDL, you'd have
Service1 { func1(); func2(); } Service2 { func1(); func2(); }
Your information about 2005 helps though - that may end up being our solution. :) -
We have a web service that is growing large enough that we wish to seperate logic. Ideally, we would have multiple code files on the server, and the service itself would still appear to be the same to consumers of it. If we were doing it in c++, we would simply split the implementation of our WebService class across several .cpp. Of course, we can't do that in C#. Any ideas or pointers to docs?
What do you mean "large enough"? Is it too large to maintain on the server or is it too large for any client to handle? Any good enterprise application has multiple layers of implementation to facilitate stuff like this. The exposed web service is just another layer in the API so nothing says it needs to needs to match any actual implementation details. You may have 100 objects that that are needed to make the web service "http://server/service" function but changing any one of them shouldn't change the service definition itself. You should be able to modify any of the 100 objects and not have to modify the interface for the web service. If this isn't happening now then you should rethink about the design. Although
partial
may help, your team should really be asking themselves do they really need a gigantic object so large it needs to span multiple files? -
What do you mean "large enough"? Is it too large to maintain on the server or is it too large for any client to handle? Any good enterprise application has multiple layers of implementation to facilitate stuff like this. The exposed web service is just another layer in the API so nothing says it needs to needs to match any actual implementation details. You may have 100 objects that that are needed to make the web service "http://server/service" function but changing any one of them shouldn't change the service definition itself. You should be able to modify any of the 100 objects and not have to modify the interface for the web service. If this isn't happening now then you should rethink about the design. Although
partial
may help, your team should really be asking themselves do they really need a gigantic object so large it needs to span multiple files? -
Most of the logic is in other objects. It's just that this particular .asmx is going to end up being huge and it becomes a pain in the rear to deal with - to add a new function or hunt another down.
Your team should be spliting the web service *anyway* into more managable functional groups. If you are lumping everything into one giant object then it is a poor design that will cause problems down the road because it will grow like a cancer. Changing one large object/web service is trickier than one small one in an API with hundreds of objects. Regression over one large object/web service is more costly than one of many small ones. Resources consumed for one large object/web service is more "brutal" than many small ones. So on and so forth... Since it seems like a design issue there is no amount of coding or tricks that will help. The fact you are asking how to do break the object into multiple code files seems to indicate you know what is functionally disperate anyway. If you are already considering breaking up a large object into multiple files then why not break the object along those same functional lines?
-
Your team should be spliting the web service *anyway* into more managable functional groups. If you are lumping everything into one giant object then it is a poor design that will cause problems down the road because it will grow like a cancer. Changing one large object/web service is trickier than one small one in an API with hundreds of objects. Regression over one large object/web service is more costly than one of many small ones. Resources consumed for one large object/web service is more "brutal" than many small ones. So on and so forth... Since it seems like a design issue there is no amount of coding or tricks that will help. The fact you are asking how to do break the object into multiple code files seems to indicate you know what is functionally disperate anyway. If you are already considering breaking up a large object into multiple files then why not break the object along those same functional lines?
I agree. The problem is I have not been expressing myself clearly. What I want is multiple web services in the same .wsdl. (Like how MapPoints web service does it.) So the end user only has to know http://foobar/service/Product.asmx?wsdl; so they only need to configure one URL in thier application, rather than have 4 or 5 seperate web services, each with URL and proxy settings configured independantly. :mad: And before any tells me it's not possible, LOOK AT THE WSDL SPEC. Look at Mappoint! sheesh. [/end grouchy part]