Web Server General Question

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
I'm a newbie when it comes to web services.

A web service is basically a function sitting on remote server right? How does access permissions work and advertisement to others?

So an example of a good web service (good as in a good reason to use versus writing your own function) would be one that accepts a bitmap in it's parameters and returns a image of type x where you choose x by other parameters such as xType and other parameters such as dpi, size, color changes (like make it sepia, b&w, poloarized, etc). I don't know how much work this would be in GDI+, but I know I wouldn't want to tackle it for a sole use application; I'd want a library someone else made and save myself a few hours of research. And on that would you be able to make like enum's and stuff available through a service? Such as in the example above the return type parameter could be of type FileTypeEnum containing, BMP, JPG, GIF, TIF, PNG, etc.? I wouldn't think so, but at the same time I would think there would be a way to pass parameter as return values other than the built in types of .NET (string, int, char, object, DateTime, Point, etc.)

But with a web service you are limited to certain things; you obviously couldn't have something that rely's on information from the user's network or file system; and I mean that by you could have a function that returns the number of files on the user's computer, or the number of computer's on a user's network because the server would be blind to that information unless the user sent it to the service; in which case the service wouldn't be needed because the user did all the hard work.

So do I have the general idea? Or is there more to it?
 
For something like creating a bitmap you would probably be better of with a normal classlibrary - returning large bitmaps via the internet could be a major performance bottleneck.
But basically a web service is just another form of distributed programming - it offers functionality that can be accessed via standard network protocols (HTTP / HTTPS) and transfers data via XML (SOAP).

You would probably find this a good starting point.
 
The question about permissions is an interesting one though. Do the web services run on the server under the ASPNET user? Can they be setup to impersonate much like asp.net pages can?
I have tried this in the past and met with no success. I added the impersonate true line in the web.config file but I didn't provide credentials. I would guess that this wouldn't work because the web service cannot resove who is requesting the use of the service. But an asp.net page does this right?

I ran into this issue a while back when I made an asp.net procedure that would check network drives to see if files existed based on the paths. Without impersonation you get nowhere because the ASPNET user didn't have access to the directories (and adding permission would have been prohibitive). I finally added the impersonation line but with no credentials and it worked (probably because I am in the admin group). But doing the same in a web service did not work.

As far as advertising your service that gets done via wsdl and disco. You add a reference to your service in any other projects as a Web Reference and then you have access to the methods. The web reference dialog can search a machine for broadcasting web services and give you the signatures and descriptions.
 
Back
Top