Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   Expose method of class returned by web service (http://www.velocityreviews.com/forums/t782062-expose-method-of-class-returned-by-web-service.html)

Toby Mathews 10-28-2003 12:43 PM

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



Dino Chiesa [Microsoft] 10-28-2003 08:40 PM

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
>
>




Mohan 11-04-2003 07:44 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57