Accessing Microsoft Translator HTTP webservice
-
2012년 4월 17일 화요일 오후 8:05
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.
모든 응답
-
2012년 4월 23일 월요일 오후 4:25
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)
-
2012년 4월 24일 화요일 오전 2:45I 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"?
-
2012년 4월 24일 화요일 오후 3:46
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
-
2012년 4월 25일 수요일 오후 3:46
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
-
2012년 4월 25일 수요일 오후 3:49So can it only be accessed by POST, not GET?
-
2012년 4월 26일 목요일 오후 2:17
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