Re: How to expose a class in the Webservice.




"John Saunders [MVP]" wrote:

Mani" <Mani@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C221C25-4841-4E78-A254-3BB513183154@xxxxxxxxxxxxxxxx
Hi,

I have a webservice which uses a c# Dll,This Dll is a C# class library
which
contain few class[Class One, Class Two] .
I am able to see the class when in the Web service but when i create a
stubb
class of the webservice using wsdl.exe then these classes are not
exposed.Both the class are public.
I tried for a while and found that if I use these class(one and two) as
the
parameter in the WebMethods the web service and generate the Stubb class
then
these class are exposed.
For ex::

[WebMethod(EnableSession = true)]
public string GetClass(One one)
{
return ;
}
//Method1

This is one way but is there any other way of exposing the class without
exposing in the WebMethod?

What do you want to do with the class on the client if you don't want to
send it to the web service or receive it from the web service?

A web service isn't a class library. It is a way to perform particular
operations on particular kinds of data, expressed in XML and described in
XML.

Also, please be aware that even if your client referred to the same C# DLL
as the Web Service does, the two would not be able to communicate directly
using classes in the C# DLL. The client and server are very strongly
separated in the case of Web Services, and they only communicate via XML,
XML Schema and WSDL. One thing they cannot communicate is the identity of
classes. Therefore, class "ClassLibrary.Class1" on the client and class
"ClassLibrary.Class1" on the server, are two totally different and unrelated
classes.

I hope that's not too discouraging. Please provide more detail of what
you're trying to accomplish, and maybe we'll be of more help.
--

John Saunders [MVP]




The reson behind why i want to expose the classes with out using in the
Web-Method is ,there are few classes which perform some calucalation and
operation(For Ex:: Class Calculate) and it is been used in the class One and
Two and i dont want to add all these classes in the webmethod as the
parameter.
So when i generate a Stubb class using the Wsdl.exe the class Calculate is
not exposed as it is not been passed as parameter in the WebMethod.This is
just one small example of a class , I have few more classes like this which i
want to expose in the web-service client so that i perform few
operations(validating and calculating) before calling the webmethod.
How can i achive this ?.Is there any way through which i can say a
particlular class to be exposed in the Stubbed class(Webservice Class) with
out adding as a parameter in the web-method.

Regards
Mani.
.



Relevant Pages

  • calling java from DOTNET 2? how stable or painfull?
    ... (sorry but i posted this in a dotnet newsgroup as well becoue i ... so i need to write an RMI CLIENT to this thing, and expose it microsoft ... at first we thought to have it exposed as web service and consume this ... service via dotnet dll. ...
    (comp.lang.java.programmer)
  • calling java from DOTNET 2? how stable painfull?
    ... so i need to write an RMI CLIENT to this thing, and expose it microsoft ... at first we thought to have it exposed as web service and consume this ... service via dotnet dll. ... developers which canno parse XML. ...
    (microsoft.public.dotnet.framework)
  • Re: How to expose a class in the Webservice.
    ... I have a webservice which uses a c# Dll,This Dll is a C# class library ... parameter in the WebMethods the web service and generate the Stubb ... What do you want to do with the class on the client if you don't want to ... The reson behind why i want to expose the classes with out using in the ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Web service and business logic
    ... I want to expose that method, GetAddressType thru a web service. ... Dim AddressType As New Auxiliar.AddressType ... In the client side though, when I call the web service method, I try to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to expose a class in the Webservice.
    ... parameter in the WebMethods the web service and generate the Stubb class ... XML. ... please be aware that even if your client referred to the same C# DLL ...
    (microsoft.public.dotnet.framework.webservices)