[newbie] webservice questions

G

Guest

Hi,

I'm new to .net webservices (esp. with .net framework 2.0) and I have these
questions - perhaps one of the gurus in here could give me some hints...

- I just created a WebMethod() that shall return a value of type ArrayList.
But when I try to call the webmethod in my client - the return value
declaration has changed to "Object()". How can I return a value of type
ArrayList in a webmethod?

- How can I get the client (and servers) IP addresses or ports?

- When I use an SSL certificate on the server to encrypt the connection - do
I need to change the code on the clients side?

Thanks a lot for any help
Peter
 
J

Joshua Flanagan

- I just created a WebMethod() that shall return a value of type ArrayList.
But when I try to call the webmethod in my client - the return value
declaration has changed to "Object()". How can I return a value of type
ArrayList in a webmethod?

As far as I know, you can't. More importantly, you probably don't want
to. WebServices are inteded to be interoperable across multiple
languages and platforms. Other languages and platforms do not
necessarily have a definition for an ArrayList. Your web service should
just return an array of items. The client program is free to use
whatever mechanisms are available in their platform to deal with the
array (a .NET client could load the array into an ArrayList if it wants
to use the data as an ArrayList locally).
If you don't care about interoperability, and know you will only have
..NET clients, .NET Remoting might be a more appropriate technology,
instead of web services. Using the HTTP channel and IIS as a host, you
can use remoting across the internet.
- How can I get the client (and servers) IP addresses or ports?

Derive your webservice class from System.Web.Services.WebService. Check
out the documentation for this class:
http://msdn.microsoft.com/library/d...rlrfSystemWebServicesWebServiceClassTopic.asp

You should find the information you are looking for (look at the Context
property, which has a Server and Request property).

- When I use an SSL certificate on the server to encrypt the connection - do
I need to change the code on the clients side?

Not necessarily the code, if the server URL is stored in a configuration
file. Make sure the URL includes https://
I do not think there are any additional changes required, but I am not
completely confident. Try it out.


Joshua Flanagan
http://flimflan.com/blog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top