Re: How to expose a class in the Webservice.
- From: "John Saunders [MVP]" <john.saunders at trizetto.com>
- Date: Fri, 13 Apr 2007 11:53:12 -0400
"Mani" <Mani@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E9C17913-7A20-4FED-8E04-9179C472783A@xxxxxxxxxxxxxxxx
"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.
No, there is no simple way to do this.
If these are just helper classes, then they should be in their own assembly,
which you could distribute to the clients. They could use these classes to
produce the values sent to the web service.
--
John Saunders [MVP]
.
- References:
- Re: How to expose a class in the Webservice.
- From: John Saunders [MVP]
- Re: How to expose a class in the Webservice.
- From: Mani
- Re: How to expose a class in the Webservice.
- Prev by Date: Re: form authentication for Webservices
- Next by Date: Web services questions
- Previous by thread: Re: How to expose a class in the Webservice.
- Next by thread: Problem calling method when cookieless is set to true
- Index(es):
Relevant Pages
|
Loading