Partager via


VC# Express Beta2 and MapPoint WebService (oh man!)

I'm currently working on an article introducing C# Express edition for one of the local developer magazines and my plan was to take the ScreenSaver example that ships with the product and extend it a little. In particualr, I wanted to introduce the concept of calling web services. Instead of using a folder with images as the background for the screensaver, I wanted to pull down a map centred on an address that the user entered into the options dialog (and then verified via MapPoint's FindServiceSoap service).

So, I added a reference to the MapPoint wsdl and away I went. Things started getting strange when I called the service. In particular, I'd get an exception:

 Server did not recognize the value of HTTP Header SOAPAction:
   https://s.mappoint.net/mappoint­-30/FindAddress. 

Long story short, what it looks like is happenning is that the WSDL generator that generates reference.cs is not handling the fact that MapPoint has 4 services defined in the WSDL (Common, Find, Render and Route), that is to say, it's kind of recognising the fact in that it generates stubs for all of those services and their methods and data types, it just gets it wrong.

Each of the services needs a separate URL to call the methods, but the code just seems to use the first one it finds in the WSDL (in this case, the URL for the Common service) . There's only one entry in the Settings where there should be four and the Reference.cs code only uses that one setting.

To fix this manually, add the following settings to the Settings.Settings (You'll obviously need to change ScreenSaver1 to the name of your project, or call it whatever you want, as long as you reference it correctly in Reference.cs)

Name Type Scope Value
ScreenSaver1_net_mappoint_staging_FindService (Web Service URL) Application https://findv3.staging.mappoint.net/Find-30/FindService.asmx
ScreenSaver1_net_mappoint_staging_RouteService (Web Service URL) Application https://routev3.staging.mappoint.net/Route-30/RouteService.asmx
ScreenSaver1_net_mappoint_staging_RenderService (Web Service URL) Application https://renderv3.staging.mappoint.net/Render-30/RenderService.asmx

Now open up Reference.cs (easiest way to do this is to right-click on one of the web service objects and choose Go To Definition) and fix the settings for each of the 3 services

 public RenderServiceSoap() {
   this.Url = ScreenSaver1.Properties.Settings.Default.ScreenSaver1_net_mappoint_staging_CommonService;

becomes

 public RenderServiceSoap() {
   this.Url = ScreenSaver1.Properties.Settings.Default.ScreenSaver1_net_mappoint_staging_RenderService;
 public RouteServiceSoap() {
   this.Url = ScreenSaver1.Properties.Settings.Default.ScreenSaver1_net_mappoint_staging_CommonService;

becomes

 public RouteServiceSoap() {
   this.Url = ScreenSaver1.Properties.Settings.Default.ScreenSaver1_net_mappoint_staging_RouteService;

and

 public FindServiceSoap() {
   this.Url = ScreenSaver1.Properties.Settings.Default.ScreenSaver1_net_mappoint_staging_CommonService;

becomes

 public FindServiceSoap() {
   this.Url = ScreenSaver1.Properties.Settings.Default.ScreenSaver1_net_mappoint_staging_FindService;

I'm sure this will be fixed during the Beta process.

Hope this helps some folk.

Comments

  • Anonymous
    May 05, 2005
    Andrew Coates has a nice post explaining how to make VS .NET 2005 Beta 2 work with MapPoint Web Service,...
  • Anonymous
    June 13, 2005
    Say hypothetically you're working on a MapPoint WebService using some flavour of Visual Studio 2005 Beta...
  • Anonymous
    July 11, 2005
    Say hypothetically you're working on an application that will consume a MapPoint WebService using...
  • Anonymous
    July 31, 2005

    Ok, I'll admit it, I've been putting off trying out
    MapPoint for quite some time
    but last week...
  • Anonymous
    August 06, 2005
    Ok, I'll admit it, I've been putting off trying out MapPoint for quite some time but last week I had...
  • Anonymous
    August 06, 2005

    Ok, I'll admit it, I've been putting off trying out
    MapPoint for quite some time
    but last week...
  • Anonymous
    August 06, 2005
    Ok, I'll admit it, I've been putting off trying out MapPoint for quite some time but last week I had...
  • Anonymous
    August 08, 2005
    Ok, I'll admit it, I've been putting off trying out MapPoint for quite some time but last week I had...
  • Anonymous
    November 20, 2007
    I'm in Perth as a result of GITA inviting me to speak at their Seminar and Workshops . I presented on
  • Anonymous
    November 20, 2007
    I'm in Perth as a result of GITA inviting me to speak at their Seminar and Workshops . I presented