Discussion:
GEOCODE METHOD RETURNS CREDENTIAL ERROR
(too old to reply)
Lee S
2009-05-05 22:48:01 UTC
Permalink
Hi,
I have a developer for virtual earth.
I can get retreive a client token by using token service successfully.
I used that token to Credentials property of GeocodeRequest class.
When executing Geocode method, i get the following error:
"Credentials are either invalid or unspecified".
I am using the following URL for geocoding service:
http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl

I am unable to proceed further in my development.
Any feedback is greatly appreciated.

Addition : By the way, I think the token is not the problem since
ImageryService is working correctly with that token.


Regards,
Lee
Flieks
2009-07-17 16:42:02 UTC
Permalink
Post by Lee S
Hi,
I have a developer for virtual earth.
I can get retreive a client token by using token service successfully.
I used that token to Credentials property of GeocodeRequest class.
"Credentials are either invalid or unspecified".
http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl
I am unable to proceed further in my development.
Any feedback is greatly appreciated.
Addition : By the way, I think the token is not the problem since
ImageryService is working correctly with that token.
Regards,
Lee
Flieks
2009-07-17 17:31:01 UTC
Permalink
My apologies for my previous post.

I have exactly the same problem.

this is my code in my web service:

[OperationContract]
public string GetCred()
{
// Add your operation implementation here
CommonService commonService = new CommonService();
commonService.Url =
"https://staging.common.virtualearth.net/find-30/common.asmx";

commonService.Credentials = new
System.Net.NetworkCredential("VE_Login", "VE_Pass");

TokenSpecification tokenSpec = new TokenSpecification();
tokenSpec.ClientIPAddress = "81.83.192.232";
//System.Web.HttpContext.Current.Request.UserHsotAddress; //this is my ip
from whatismyip. the other code gave 127.0.0.0
tokenSpec.TokenValidityDurationMinutes = 480;

return commonService.GetClientToken(tokenSpec);
}

this is my code at client silverlight app copied from the interactive
silverlight SDK demo:

private void ReverseGeocodeAsync(Location location)
{
request = new PlatformServices.ReverseGeocodeRequest();
request.Culture = MyMap.Culture;
request.Location = new PlatformServices.Location();
request.Location.Latitude = location.Latitude;
request.Location.Longitude = location.Longitude;

request.ExecutionOptions = new
PlatformServices.ExecutionOptions();
request.ExecutionOptions.SuppressFaults = true;

loc = location;

ServiceReference1.Service1Client cl = new
Openingsuren.ServiceReference1.Service1Client();
cl.GetCredCompleted += new
EventHandler<Openingsuren.ServiceReference1.GetCredCompletedEventArgs>(cl_GetCredCompleted);
cl.GetCredAsync();
}

void cl_GetCredCompleted(object sender,
Openingsuren.ServiceReference1.GetCredCompletedEventArgs e)
{
request.Credentials = new
Openingsuren.PlatformServices.Credentials();
request.Credentials.Token = e.Result;
geocodesInProgress++;
// Make asynchronous call to fetch the data ... pass state object.
GeocodeClient.ReverseGeocodeAsync(request, loc);
}


Then the request comes back and executes this:

private void client_ReverseGeocodeCompleted(object sender,
PlatformServices.ReverseGeocodeCompletedEventArgs e)
{

and in this method i have a

Openingsuren.PlatformServices.AuthenticationResultCode.InvalidCredentials

and a
faultreason: "Credentials are either invalid or
unspecified."
Flieks
2009-07-17 19:00:20 UTC
Permalink
I just tested and the calculateroute service works fine
and returns a resultcode of success.

But ReverseGeocode service return BadRequest.
Flieks
2009-07-17 19:06:01 UTC
Permalink
if i use
commonService.Url =
"http://staging.common.virtualearth.net/find-30/common.asmx";

or
commonService.Url =
"https://staging.common.virtualearth.net/find-30/common.asmx";

it gives the same endresult. So calculateroute works, geocode doesn't.
Raghu
2009-07-21 06:07:01 UTC
Permalink
I have exactly the same problem. I can get the token but not the Geocode
operation to succeeed. It throws "Credentials are either invalid or
unspecified." fault exception. On the GeocodeRequest, I create a brand new
Credentials instance and assign it token value to the one obtained from the
first web service call. The web service config for the GeocodeService is:

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGeocodeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
address="http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IGeocodeService"
contract="ServiceReference1.IGeocodeService"
name="BasicHttpBinding_IGeocodeService" />
</client>
</system.serviceModel>

Here is my code:

TokenSpecification spec = new TokenSpecification();
spec.ClientIPAddress = myIPAddress;
spec.TokenValidityDurationMinutes = 60;

CommonServiceSoap tokenService = new CommonServiceSoap();
tokenService.Credentials = new NetworkCredential(myAccount,
myPassword);

//This works fine
string token = tokenService.GetClientToken(spec);

GeocodeRequest request = new GeocodeRequest();
request.Credentials = new Credentials();
request.Credentials.Token = token;

request.Query = "23405 N 22nd Way, AZ 85024";

// Set the options to only return high confidence results
ConfidenceFilter[] filters = new ConfidenceFilter[1];
filters[0] = new ConfidenceFilter();
filters[0].MinimumConfidence = Confidence.High;

GeocodeOptions geocodeOptions = new GeocodeOptions();
geocodeOptions.Filters = filters;

request.Options = geocodeOptions;

// Make the geocode request

GeocodeResponse response = null;
try
{
GeocodeServiceClient c = new GeocodeServiceClient();

//********** The following line throws exception **********
response = c.Geocode(request);
}
catch (Exception ex)
{
throw;
}

lblResults.Text = response.Results[0].DisplayName;

Any help is greatly appreciated.

Thanks.
Raghu/..
Post by Lee S
Hi,
I have a developer for virtual earth.
I can get retreive a client token by using token service successfully.
I used that token to Credentials property of GeocodeRequest class.
"Credentials are either invalid or unspecified".
http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl
I am unable to proceed further in my development.
Any feedback is greatly appreciated.
Addition : By the way, I think the token is not the problem since
ImageryService is working correctly with that token.
Regards,
Lee
Flieks
2009-07-21 15:34:04 UTC
Permalink
You can use the arcgis web service for now
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Geocode_EU/GeocodeServer/findAddressCandidates?Address=""&City=""&Country="""

it doesn't require a token or sth but i don't think you can use it alot as
it's free. I just use it to get all the coordinates and put them in my
database for later use.

but i would like to work wit the bing geocode service for live purposes
later so still need the solution.
Raghu
2009-07-23 02:42:03 UTC
Permalink
I have had it with this confusing documentation and a service that does not
work. Finally switched to goolg map API. Life is much simpler again. You can
find more details here:

http://raghublog.spaces.live.com/blog/cns!A14B74C78236FC66!280.entry

Raghu/..
Post by Raghu
I have exactly the same problem. I can get the token but not the Geocode
operation to succeeed. It throws "Credentials are either invalid or
unspecified." fault exception. On the GeocodeRequest, I create a brand new
Credentials instance and assign it token value to the one obtained from the
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGeocodeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
address="http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IGeocodeService"
contract="ServiceReference1.IGeocodeService"
name="BasicHttpBinding_IGeocodeService" />
</client>
</system.serviceModel>
TokenSpecification spec = new TokenSpecification();
spec.ClientIPAddress = myIPAddress;
spec.TokenValidityDurationMinutes = 60;
CommonServiceSoap tokenService = new CommonServiceSoap();
tokenService.Credentials = new NetworkCredential(myAccount,
myPassword);
//This works fine
string token = tokenService.GetClientToken(spec);
GeocodeRequest request = new GeocodeRequest();
request.Credentials = new Credentials();
request.Credentials.Token = token;
request.Query = "23405 N 22nd Way, AZ 85024";
// Set the options to only return high confidence results
ConfidenceFilter[] filters = new ConfidenceFilter[1];
filters[0] = new ConfidenceFilter();
filters[0].MinimumConfidence = Confidence.High;
GeocodeOptions geocodeOptions = new GeocodeOptions();
geocodeOptions.Filters = filters;
request.Options = geocodeOptions;
// Make the geocode request
GeocodeResponse response = null;
try
{
GeocodeServiceClient c = new GeocodeServiceClient();
//********** The following line throws exception **********
response = c.Geocode(request);
}
catch (Exception ex)
{
throw;
}
lblResults.Text = response.Results[0].DisplayName;
Any help is greatly appreciated.
Thanks.
Raghu/..
Post by Lee S
Hi,
I have a developer for virtual earth.
I can get retreive a client token by using token service successfully.
I used that token to Credentials property of GeocodeRequest class.
"Credentials are either invalid or unspecified".
http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl
I am unable to proceed further in my development.
Any feedback is greatly appreciated.
Addition : By the way, I think the token is not the problem since
ImageryService is working correctly with that token.
Regards,
Lee
swidom
2009-07-24 03:11:01 UTC
Permalink
The problem is that your code is calling the wrong web service (I am assuming
you are using the staging environment and not the Production). Here is a URL
that tells you what service URL you should be using:

http://www.eggheadcafe.com/conversation.aspx?messageid=34097291&threadid=33247523

In short, you need to call the following:

http://staging.dev.virtualearth.net/webservices/v1/GeocodeService/GeocodeService.svc

and NOT:

http://dev.virtualearth.net/webservices/v1/GeocodeService/GeocodeService.svc

This will fix your problem.

-Steve
Post by Raghu
I have had it with this confusing documentation and a service that does not
work. Finally switched to goolg map API. Life is much simpler again. You can
http://raghublog.spaces.live.com/blog/cns!A14B74C78236FC66!280.entry
Raghu/..
Post by Raghu
I have exactly the same problem. I can get the token but not the Geocode
operation to succeeed. It throws "Credentials are either invalid or
unspecified." fault exception. On the GeocodeRequest, I create a brand new
Credentials instance and assign it token value to the one obtained from the
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGeocodeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
address="http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IGeocodeService"
contract="ServiceReference1.IGeocodeService"
name="BasicHttpBinding_IGeocodeService" />
</client>
</system.serviceModel>
TokenSpecification spec = new TokenSpecification();
spec.ClientIPAddress = myIPAddress;
spec.TokenValidityDurationMinutes = 60;
CommonServiceSoap tokenService = new CommonServiceSoap();
tokenService.Credentials = new NetworkCredential(myAccount,
myPassword);
//This works fine
string token = tokenService.GetClientToken(spec);
GeocodeRequest request = new GeocodeRequest();
request.Credentials = new Credentials();
request.Credentials.Token = token;
request.Query = "23405 N 22nd Way, AZ 85024";
// Set the options to only return high confidence results
ConfidenceFilter[] filters = new ConfidenceFilter[1];
filters[0] = new ConfidenceFilter();
filters[0].MinimumConfidence = Confidence.High;
GeocodeOptions geocodeOptions = new GeocodeOptions();
geocodeOptions.Filters = filters;
request.Options = geocodeOptions;
// Make the geocode request
GeocodeResponse response = null;
try
{
GeocodeServiceClient c = new GeocodeServiceClient();
//********** The following line throws exception **********
response = c.Geocode(request);
}
catch (Exception ex)
{
throw;
}
lblResults.Text = response.Results[0].DisplayName;
Any help is greatly appreciated.
Thanks.
Raghu/..
Post by Lee S
Hi,
I have a developer for virtual earth.
I can get retreive a client token by using token service successfully.
I used that token to Credentials property of GeocodeRequest class.
"Credentials are either invalid or unspecified".
http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl
I am unable to proceed further in my development.
Any feedback is greatly appreciated.
Addition : By the way, I think the token is not the problem since
ImageryService is working correctly with that token.
Regards,
Lee
Raghu
2009-07-24 04:46:02 UTC
Permalink
Thanks for the reply. But as my web.config file indicates, I am using exactly
the same service that you said I should use. I don't know where you got the
other endpoint.

Raghu/..
Post by swidom
The problem is that your code is calling the wrong web service (I am assuming
you are using the staging environment and not the Production). Here is a URL
http://www.eggheadcafe.com/conversation.aspx?messageid=34097291&threadid=33247523
http://staging.dev.virtualearth.net/webservices/v1/GeocodeService/GeocodeService.svc
http://dev.virtualearth.net/webservices/v1/GeocodeService/GeocodeService.svc
This will fix your problem.
-Steve
Post by Raghu
I have had it with this confusing documentation and a service that does not
work. Finally switched to goolg map API. Life is much simpler again. You can
http://raghublog.spaces.live.com/blog/cns!A14B74C78236FC66!280.entry
Raghu/..
Post by Raghu
I have exactly the same problem. I can get the token but not the Geocode
operation to succeeed. It throws "Credentials are either invalid or
unspecified." fault exception. On the GeocodeRequest, I create a brand new
Credentials instance and assign it token value to the one obtained from the
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGeocodeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
address="http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IGeocodeService"
contract="ServiceReference1.IGeocodeService"
name="BasicHttpBinding_IGeocodeService" />
</client>
</system.serviceModel>
TokenSpecification spec = new TokenSpecification();
spec.ClientIPAddress = myIPAddress;
spec.TokenValidityDurationMinutes = 60;
CommonServiceSoap tokenService = new CommonServiceSoap();
tokenService.Credentials = new NetworkCredential(myAccount,
myPassword);
//This works fine
string token = tokenService.GetClientToken(spec);
GeocodeRequest request = new GeocodeRequest();
request.Credentials = new Credentials();
request.Credentials.Token = token;
request.Query = "23405 N 22nd Way, AZ 85024";
// Set the options to only return high confidence results
ConfidenceFilter[] filters = new ConfidenceFilter[1];
filters[0] = new ConfidenceFilter();
filters[0].MinimumConfidence = Confidence.High;
GeocodeOptions geocodeOptions = new GeocodeOptions();
geocodeOptions.Filters = filters;
request.Options = geocodeOptions;
// Make the geocode request
GeocodeResponse response = null;
try
{
GeocodeServiceClient c = new GeocodeServiceClient();
//********** The following line throws exception **********
response = c.Geocode(request);
}
catch (Exception ex)
{
throw;
}
lblResults.Text = response.Results[0].DisplayName;
Any help is greatly appreciated.
Thanks.
Raghu/..
Post by Lee S
Hi,
I have a developer for virtual earth.
I can get retreive a client token by using token service successfully.
I used that token to Credentials property of GeocodeRequest class.
"Credentials are either invalid or unspecified".
http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl
I am unable to proceed further in my development.
Any feedback is greatly appreciated.
Addition : By the way, I think the token is not the problem since
ImageryService is working correctly with that token.
Regards,
Lee
Loading...