首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在WP上调用Bing转换器服务

无法在WP上调用Bing转换器服务
EN

Stack Overflow用户
提问于 2012-11-23 08:08:00
回答 1查看 1.4K关注 0票数 2

迁移后,微软在必应翻译上提供少量功能的美好时光已经一去不复返了。新的账号密钥只对新的服务根有效:

代码语言:javascript
复制
https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1 

而不是像这样的东西:

代码语言:javascript
复制
http://api.microsofttranslator.com/V1/SOAP.svc

或者:

代码语言:javascript
复制
http://api.microsofttranslator.com/V1/SOAP.svc

这还不是结束。当我尝试向它添加服务引用时,VS只是说:

代码语言:javascript
复制
EntityType 'Microsoft.Translation' has no key defined. Define the key for this EntityType.

或者在权限上抛出异常。

在此之前,我尝试使用订阅附带的Helper类。我花了很长时间来修改在WP8上使用的代码-关于System.Data.Services.Client上的一些问题(客户端上WCF5造成的一些不兼容?)和异步调用。结果是:

代码语言:javascript
复制
System.InvalidOperationException:There is a type mismatch between the client and the service. Type 'Microsoft.Translation' is not an entity type, but the type in the response payload represents an entity type. Please ensure that types defined on the client match the data model of the service, or update the service reference on the client.

我检查了响应,没有发现任何错误:

代码语言:javascript
复制
After the migration, gone are the good old days when Microsoft provides a handful of functions on Bing Translation. And new account keys are only valid to the new service root:

https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1 

而不是像这样的东西:

代码语言:javascript
复制
http://api.microsofttranslator.com/V1/SOAP.svc

或者:

代码语言:javascript
复制
http://api.microsofttranslator.com/V1/SOAP.svc

这还不是结束。当我尝试向它添加服务引用时,VS只是说:

代码语言:javascript
复制
EntityType 'Microsoft.Translation' has no key defined. Define the key for this EntityType.

或者在权限上抛出异常。

在此之前,我尝试使用订阅附带的Helper类。我花了很长时间来修改在WP8上使用的代码-关于System.Data.Services.Client上的一些问题(客户端上WCF5造成的一些不兼容?)和异步调用。结果是:

代码语言:javascript
复制
System.InvalidOperationException:There is a type mismatch between the client and the service. Type 'Microsoft.Translation' is not an entity type, but the type in the response payload represents an entity type. Please ensure that types defined on the client match the data model of the service, or update the service reference on the client.

我检查了响应,没有发现任何错误:

代码语言:javascript
复制
  Microsoft Translator   https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/Translate?Text='hello'&To='nl'      2012-11-22T23:20:10Z           https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/Translate?Text='hello'&To='nl'&$skip=0&$top=1     Translation     2012-11-22T23:20:10Z                          Hallo                 (Sorry but the xml doesn't display properly.)

我甚至尝试使用传统的方法访问OData,但都是徒劳的。说实话有点生气..。

我已经用谷歌搜索了足够多,但仍然找不到新的Bing翻译器界面的解决方案。有没有人和我的有类似的问题?提前谢谢。

我甚至尝试使用传统的方法访问OData,但都是徒劳的。说实话有点生气..。

我已经用谷歌搜索了足够多,但仍然找不到新的Bing翻译器界面的解决方案。有没有人和我的有类似的问题?提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2012-11-27 21:29:41

这里有一个关于如何在Windows phone7中做到这一点的教程:http://blogs.msdn.com/b/translation/p/wp7translate.aspx

确保在Azure上正确获取您的客户端ID和客户端密钥--为此,请在https://datamarket.azure.com/developer/applications注册您的应用程序

请使用你在此处注册的应用的客户端ID和客户端密码,而不是将Azure帐户作为一个整体使用。

此外,如果您收到错误,最好确保您的translator订阅处于活动状态。您可以通过以下地址进行检查:https://datamarket.azure.com/account/datasets

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13521607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档