Asked by:
Accessing Microsoft Translator HTTP webservice

Question
-
I want to access Microsoft Translator web service through HTTP interface. After obtaining an access token I can't obtain any translation. I put
http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=Bearer <token>&text=Hello&from=en&to=fr
into the my browser address field (<token> is the token i received from Azure). It returns me the error message:
The Web Token must have a signature at the end. The incoming token did not have a signature at the end of the token.
I have tried replacing <token> with URI encoded(<token>), replacing the space after "Bearer" with a "+" without any result.
Please help me! Thanks.
Tuesday, April 17, 2012 8:05 PM
All replies
-
Hi Clovis,
Have you had a chance to look the following sites? The sample codes provided there should work for you.
http://msdn.microsoft.com/en-us/library/ff512387.aspx
http://msdn.microsoft.com/en-us/library/ff512421.aspx
Let me know how it goes.
Thanks. Takako (Microsoft Translator Team)
Monday, April 23, 2012 4:25 PM -
I also have the same problem, but the documents listed above don't give the answer. The error message is that the token is lacking a signature at the end but the references given don't refer to a signature. At the end of the token, shouldn't the GET url simply continue with "&" on to the next parameter? What is a "signature"?Tuesday, April 24, 2012 2:45 AM
-
Hi Skylang and Clovis,
The sites below discuss a "signature" issue. Take a look. Hope that you can find a solution there. Let us know how it goes. Takako
Tuesday, April 24, 2012 3:46 PM -
Take a look at the code I posted in these threads:
Some Code Samples:
C# Asynchronous and Synchronous examples in here:
http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/02054a7c-090c-46a0-a8d1-2d57e236eb4d
And VB on this thread:
http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/3f9a270e-3360-4aa1-9eb8-669145298d45I have verified that these are working for the service...see if you are doing anything different?
//Laurence Moroney: www.netnavi.tv // Author of 'Introducing Silverlight' series and much more // @lmoroney
Wednesday, April 25, 2012 3:46 PM -
So can it only be accessed by POST, not GET?Wednesday, April 25, 2012 3:49 PM
-
For GET, try this:
string headerValue = "Bearer " + token.access_token;
string uri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?appid= " + System.Net.HttpUtility.UrlEncode(headerValue) + "&text=" + System.Net.HttpUtility.UrlEncode(strTextToTranslate) + "&from=en&to=es";
Note that I System.Net.HttpUtility.UrlEncode the header Value containing the Bearer.
I've tried this on the Ajax.svc and it worked...haven't had time to rebuild my app to see if that works with the Http service, because I usually POST with that...
//Laurence Moroney: www.netnavi.tv // Author of 'Introducing Silverlight' series and much more // @lmoroney
Thursday, April 26, 2012 2:17 PM