I am not a developer, so I do not have a deeper knowledge of the methods how to use and access web-services. But in Visual Studio 2005 it was very easy. Just configure a web-reference, set the credentials when accessing and configure the web-address, when it differs from the address in the development environment. Very straight forward, very easy.

Today I tried the same in Visual Studio 2008, and I think it’s a little bit difficult. It is possible to configure the reference to the web-service as in Visual Studio 2005.

image

But I think, these are legacy settings. When we use Visual Studio 2008, we will use the new and current technologies. So, what do we have to do, when we want to access web-services from SharePoint. First we create a new project in Visual Studio, in this case a console application.

Now we need to add a Service Reference. In this example we use the Lists-web-service and access the functionality using the namespace WssLists.

image

In your project you will find a file named app.config. Open this file and it should look like this.

image

Locate the security-node and modify it. After your modification your security-node should look like this:

image

Now we can write our custom code to access this web-service. An example could look like this:

image

When we instantiate the WssLists.ListsSoapClient-class, we use the string “ListsSoap” as the first parameter. You find the value for this parameter in the app.config in the client/endpoint-node.

image

Compile this code, run your program and enjoy.

Advertisements