![]() |
Expose method of class returned by web service
Hi there,
Could anyone tell me if it is possible to expose the methods of a class returned by a web service. I have an instance of a class created something like this: MyWebService webSrv = new MyWebService(); MyWebService.MyClass myClass = webSrv.GetClass(); The definition for MyClass in my web service includes some methods, say MyClass.Method(), but these aren't visible from the client consuming the web service. Any help much appreciated, thanks, Toby Mathews |
Re: Expose method of class returned by web service
The class has to be known to the client. There must be an implementation of
the class on the client side, in the form of a DLL. It should be the same impl as used on the server side. ie: it should be in a shared dLL. You need to 1. use targetNameSpace attribute on the type you want to share across client and server. compile this into a DLL - you need to deploy this on both client and server. 2. when you "Add Web Reference" or generate the proxy with wsdl.exe, you need to remove the generated types from the source code. Replace references to the generated type(s) with the common type(s) from the DLL in step 1. Each time you update the WSDL and re-generate the proxy, you have to do this manual edit step. 3. compile the client and server, referencing the common DLL. Here's an old blog entry on tihs: http://hoppersoft.com/Andy/commentvi...5-23B733FF3C5D and a sort-of related KB article http://support.microsoft.com/default...b;en-us;326790 -Dino -- Dino Chiesa Microsoft Developer Division d i n o c h @ o n l i n e . m i c r o s o f t . c o m "Toby Mathews" <NO-tobym-SPAM@NOSPAMcix.co.uk> wrote in message news:%23QBMoEVnDHA.3288@tk2msftngp13.phx.gbl... > Hi there, > > Could anyone tell me if it is possible to expose the methods of a class > returned by a web service. I have an instance of a class created something > like this: > > MyWebService webSrv = new MyWebService(); > > MyWebService.MyClass myClass = webSrv.GetClass(); > > The definition for MyClass in my web service includes some methods, say > MyClass.Method(), but these aren't visible from the client consuming the web > service. > > Any help much appreciated, thanks, > > Toby Mathews > > |
Expose method of class returned by web service
Hi,
What you're trying to achieve is workable; but the best practise is not to have business functionality in the object that you're receiving, rather it has to be a container. These will avoid having the proxy class as dll and client just access the web services and make use of it immediately rather than waiting for the dll. Have a look at this it might help you. http://msdn.microsoft.com/msdnmag/is...2/WebServicesD esign/ >-----Original Message----- >Hi there, > > Could anyone tell me if it is possible to expose the methods of a class >returned by a web service. I have an instance of a class created something >like this: > >MyWebService webSrv = new MyWebService(); > >MyWebService.MyClass myClass = webSrv.GetClass(); > > The definition for MyClass in my web service includes some methods, say >MyClass.Method(), but these aren't visible from the client consuming the web >service. > > Any help much appreciated, thanks, > >Toby Mathews > > >. > |
| All times are GMT. The time now is 11:40 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.