Udostępnij za pośrednictwem


Consuming a MapPoint Web Service with Windows Communication Foundation (WCF)...

The issue with the MapPoint service is that it uses digest authentication, but the WSDL itself does not contain any policy stating this. Therefore, when you generate proxy class and config to consume the Service, it will fail until you add the appropriate configuration and client credentials. If I have time, I'll add another post with the updated WSDL.

To get it working you need to do the following:

  • Add a Service Reference (if you're using dev tools for .NET 3.0) or create a proxy class using svcutil.exe to the MapPoint Service
  • Where ever you see a binding configuration section, update the security section from
  • <security mode="None">
  • <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
  • <message clientCredentialType="UserName" algorithmSuite="Default" />
  • </security>

 to

  • <

security mode="TransportCredentialOnly">

<

transport clientCredentialType="Digest" proxyCredentialType="None" realm="" />

<

message clientCredentialType="UserName" algorithmSuite="Default" />

</

security>

  • Add the appropriate client credentials in code:

Dim myService As New ServiceReference.FindServiceSoapClient
myService.ClientCredentials.HttpDigest.ClientCredential = New NetworkCredential(username, password)
myService.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation

Note: In order to use the MapPoint service (i.e. get a user name and password) you will need to register here: https://mappoint-css.partners.extranet.microsoft.com/MwsSignup/Eval2.aspx