Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > ASP .NET 2.0 web service beginner question - Multiple classes

Reply
Thread Tools

ASP .NET 2.0 web service beginner question - Multiple classes

 
 
crowl@gmx.de
Guest
Posts: n/a
 
      10-10-2008
I followed a few "Hello World" examples for asp web service and it
works fine. Now I want to provide the clients multiple classes they
can work with, lets say Class1, Class2, Class3.

I have created a new asp.net web service project in VS and it created
Service.asmx with

public class Service : System.Web.Services.WebService ...

Now I have added 3 Classes (Class1, Class2, Class3) by using -> Add
New Item ..., added properties and methods. All compiled well, but if
I tried to use (find) the classes in the client application there is
only the Service object nor other objects to work with. What I have to
do that Class1, Class2 and Class3 is also available at the client?

 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      10-10-2008
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I followed a few "Hello World" examples for asp web service and it
> works fine. Now I want to provide the clients multiple classes they
> can work with, lets say Class1, Class2, Class3.
>
> I have created a new asp.net web service project in VS and it created
> Service.asmx with
>
> public class Service : System.Web.Services.WebService ...
>
> Now I have added 3 Classes (Class1, Class2, Class3) by using -> Add
> New Item ..., added properties and methods. All compiled well, but if
> I tried to use (find) the classes in the client application there is
> only the Service object nor other objects to work with. What I have to
> do that Class1, Class2 and Class3 is also available at the client?


None of your server-side classes will ever be available on the client. Your
"Service" class is not available on the client. Don't believe me? Add a
private method to your "Service" class, and then go update the web reference
on the client and see if the private method show up there.

In fact, if you go look at the "Service" class that the client uses, you'll
see that it is totally different from what you wrote on the server. It
happens to have some of the same method names as your server-side class. The
signatures of those methods happens to be similar, or maybe even the same.
But the methods themselves are totally different.

That's because the client has a Proxy version of "Service", not the real
thing. The proxy class is for the purpose of calling your real "Service". It
keeps the client from having to manipulate XML and handle the underlying
protocol stuff needed to talk to a web service. The client can pretend that
it is calling a real method on a real class.

There are no proxy versions of Class1, Class2 or Class3. That is because
they are not needed in order to call your service. I bet your service has no
web methods that take an instance of any of those three classes as
parameters, nor methods that return an instance of one of those classes.
Only if they are needed to call the service will a proxy class be created
for any of your server-side classes.

Note that these extra proxy classes will not have any methods, events,
indexers or operations. They will only have properties. That is because this
is the only thing necessary to communicate with your web service. In fact,
the proxy classes will not have the "real" properties - they only have
properties that permit the data to be serialized into XML so that it can be
sent to your service, or deserialized from XML so that the data can be
received from your service.

If you simply have some code that you want a client of your web service to
be able to call, in order to perform some function that does not directly
involve your service, then you need to put that into a class library and
ship the library so that the clients have it. Of course, this won't help
with clients that are not written in .NET.

--
John Saunders | MVP - Connected System Developer

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using classes from a C++/CLI dll inside a WCF service - beginner Hedley ASP .Net Web Services 1 11-08-2013 11:51 AM
Collection and multiple classes interacting via web service!? Vaughn Haybittle ASP .Net Web Services 0 08-03-2007 10:02 PM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Multiple web service calls from web service oljeg.popovic@gmail.com ASP .Net Web Services 1 01-09-2006 09:53 AM
Beginner Help: Joining Multiple classes in multiple files? JHenstay C++ 3 01-11-2004 02:28 PM



Advertisments