Discussion:
Implementing Customer Identification
(too old to reply)
rockster
2008-07-28 16:11:03 UTC
Permalink
Trying to implement virtual earth map customer identification in staging.
I have created a web reference and the code is as follows:

net.mappoint.staging.CommonServiceSoap commonService = new
net.mappoint.staging.CommonServiceSoap();
commonService.Url = "http://staging.mappoint.net/standard-30/common.asmx";
commonService.Credentials = new
System.Net.NetworkCredential(ConfigurationManager.AppSettings["VEUserID"],
ConfigurationManager.AppSettings["VEPassword"]);
net.mappoint.staging.TokenSpecification tokenSpec = new
net.mappoint.staging.TokenSpecification();
tokenSpec.ClientIPAddress = Page.Request.UserHostAddress;
tokenSpec.TokenValidityDurationMinutes = 480;
string clienttoken = commonService.GetClientToken(tokenSpec);

The error returned is:
The request failed with HTTP status 403: Forbidden.

Any ideas?
Doug DeGenaro
2008-08-08 17:10:01 UTC
Permalink
1) did you create your development account at the VE Css site
2) did you use your account ID (not datasource name id) and password
3) Debug and see what UserHostAddress is.. what I had to do was change the
Page.Request.UserHostAddress..because if you using a router or switch I think
it gives you 127.0.0.1, I instead used this code.

string hostName = Dns.GetHostName();
string clientip = Dns.GetHostAddresses(hostName).GetValue(1).ToString();

i used the 1, because we are using IPV4.. you can get back IpAddress[] and
loop through check the ipv6 flag, then get the one that isnt that..

try the above though..good luck!
Post by rockster
Trying to implement virtual earth map customer identification in staging.
net.mappoint.staging.CommonServiceSoap commonService = new
net.mappoint.staging.CommonServiceSoap();
commonService.Url = "http://staging.mappoint.net/standard-30/common.asmx";
commonService.Credentials = new
System.Net.NetworkCredential(ConfigurationManager.AppSettings["VEUserID"],
ConfigurationManager.AppSettings["VEPassword"]);
net.mappoint.staging.TokenSpecification tokenSpec = new
net.mappoint.staging.TokenSpecification();
tokenSpec.ClientIPAddress = Page.Request.UserHostAddress;
tokenSpec.TokenValidityDurationMinutes = 480;
string clienttoken = commonService.GetClientToken(tokenSpec);
The request failed with HTTP status 403: Forbidden.
Any ideas?
Ben O'Hara
2008-10-30 20:11:01 UTC
Permalink
Hi,
I'm trying to do exactly the same, but am having the same problem.
I've verified my credentials in the Customer Services & have added a
reference to http://staging.mappoint.net/standard-30/mappoint.wsdl in visual
studio (2005).

My code is dead simple:
TokenService.CommonServiceSoap t= new TokenService.CommonServiceSoap();
t.Credentials = new System.Net.NetworkCredential(this.veDevAccountID,
this.veDevAccountPassword);
TokenService.TokenSpecification s = new TokenService.TokenSpecification();
s.ClientIPAddress = clientIP;
s.TokenValidityDurationMinutes = 1;

string token = t.GetClientToken(s);

Client IP is the current IP address of this machine.
I've checked that the account id & password are the same as I use to verify
at customer services but still get
The request failed with HTTP status 403: Forbidden.

The stack trace is:
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at
VirtualEarthImageProviderService.TokenService.CommonServiceSoap.GetClientToken(TokenSpecification specification)
at
VirtualEarthImageProviderService.VirtualEarthImageProviderService.RequestImage(String clientIP)

I'm running this on my work machine, so am behind a firewall & proxy, though
ports 80 & 8080 are open. Is this some sort of NAT problem? A proxy issue?
How can I fix this?

Any thoughts would be appreciated.

Regards

Ben
Post by Doug DeGenaro
1) did you create your development account at the VE Css site
2) did you use your account ID (not datasource name id) and password
3) Debug and see what UserHostAddress is.. what I had to do was change the
Page.Request.UserHostAddress..because if you using a router or switch I think
it gives you 127.0.0.1, I instead used this code.
string hostName = Dns.GetHostName();
string clientip = Dns.GetHostAddresses(hostName).GetValue(1).ToString();
i used the 1, because we are using IPV4.. you can get back IpAddress[] and
loop through check the ipv6 flag, then get the one that isnt that..
try the above though..good luck!
Post by rockster
Trying to implement virtual earth map customer identification in staging.
net.mappoint.staging.CommonServiceSoap commonService = new
net.mappoint.staging.CommonServiceSoap();
commonService.Url = "http://staging.mappoint.net/standard-30/common.asmx";
commonService.Credentials = new
System.Net.NetworkCredential(ConfigurationManager.AppSettings["VEUserID"],
ConfigurationManager.AppSettings["VEPassword"]);
net.mappoint.staging.TokenSpecification tokenSpec = new
net.mappoint.staging.TokenSpecification();
tokenSpec.ClientIPAddress = Page.Request.UserHostAddress;
tokenSpec.TokenValidityDurationMinutes = 480;
string clienttoken = commonService.GetClientToken(tokenSpec);
The request failed with HTTP status 403: Forbidden.
Any ideas?
Loading...