0

I have a sharepoint web service running at specified host + "/_vti_bin/UserProfileWebService.asmx". I would like to instantiate a web service client, so that i could interact with this service. This is basically what I am trying to do: http://msdn.microsoft.com/en-us/library/ms550407.aspx.

How is this done in .NET? And do I have to use the MOSS API to know what functions it supports?

EDIT: I guess I should add that I want to connect programmatically, not through a web reference, because that seems to be static.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
SpaceBear
  • 832
  • 3
  • 8
  • 22
  • I sorta asked this question before, but it never got answered in the way that i could understand: http://stackoverflow.com/questions/7113936/cannot-resolve-symbol-userprofilewebservice – SpaceBear Aug 29 '11 at 17:30
  • 1
    What do you mean, "static"? You can change the Url. – John Saunders Aug 29 '11 at 18:04
  • When I created a web reference it wanted specific location, a URL, so I thought it would be limited to that instance of the webservice, but i guess it is possible to change URL at the runtime, not sure how though... – SpaceBear Aug 29 '11 at 20:53

1 Answers1

6

In VS (2008/2010) you can add a web service reference to your console project for example. It will auto-generate the proxy classes for you to use in your code.

Philipp Schmid
  • 5,778
  • 5
  • 44
  • 66
  • Agree with Philipp and I would add that no, you don't need to use the MOSS API (whatever that is) to interact with the service. You can also look at the WSDL to see the operations provided. Simply append ?WSDL in the query string. In your case: UserProfileWebService.asmx?wsdl – Icarus Aug 29 '11 at 17:35
  • What if the service location is passed to the console project? Meaning that it is unknown where the service will reside till the client passes the url? – SpaceBear Aug 29 '11 at 17:45
  • 1
    You need to point to an existing endpoint when adding the reference (so the tool can run). At runtime you can set the URL property for the SOAPClient class to whatever you need it to be. – Philipp Schmid Aug 29 '11 at 17:48
  • Honestly, the whole process is a little weird, but it worked. Thank you very much! – SpaceBear Aug 30 '11 at 16:07