[英]HTTP status 400 when trying to add web service reference to a project
I am trying to add this WCF service reference to my Visual Studio 2012 C# project. 我正在尝试将此WCF服务引用添加到我的Visual Studio 2012 C#项目中。 When I try to load the service through the add service dialog, I get this error
当我尝试通过添加服务对话框加载服务时,我收到此错误
There was an error downloading ' https://api.onecallnow.com/WebService/3.1/soap.svc/_vti_bin/ListData.svc/ $metadata'.
下载“ https://api.onecallnow.com/WebService/3.1/soap.svc/_vti_bin/ListData.svc/ $ metadata”时出错。 The request failed with HTTP status 400: Bad Request.
请求失败,HTTP状态为400:错误请求。 Metadata contains a reference that cannot be resolved: ' https://api.onecallnow.com/WebService/3.1/soap.svc '.
元数据包含无法解析的引用:' https : //api.onecallnow.com/WebService/3.1/soap.svc '。 Content Type application/soap+xml;
内容类型application / soap + xml; charset=utf-8 was not supported by service https://api.onecallnow.com/WebService/3.1/soap.svc .
服务https://api.onecallnow.com/WebService/3.1/soap.svc不支持charset = utf-8。 The client and service bindings may be mismatched.
客户端和服务绑定可能不匹配。 The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml;
远程服务器返回错误:(415)无法处理消息,因为内容类型为'application / soap + xml; charset=utf-8' was not the expected type 'text/xml;
charset = utf-8'不是预期的类型'text / xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again.
charset = utf-8'..如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。
I've looked at other questions with this error, but almost all of them suggest changing something about the WCF service configuration, to which I don't have access. 我已经查看了这个错误的其他问题,但几乎所有问题都建议改变一些我无法访问的WCF服务配置。
Someone suggested that the last part of the message means that I am using a different version of SOAP than the service is using, but I don't see any options to change that in the Add Web Service dialog. 有人建议消息的最后部分意味着我使用的SOAP版本与服务使用的不同,但我没有看到任何在“添加Web服务”对话框中更改它的选项。
Can someone help me correctly add this service reference? 有人可以帮我正确添加此服务参考吗?
If you go the service in a browser, you will see the following: 如果您在浏览器中使用该服务,您将看到以下内容:
The service owner has disabled metadata publishing, so you will not be able to add a service reference through the Add Service Reference dialog. 服务所有者已禁用元数据发布,因此您将无法通过“添加服务引用”对话框添加服务引用。
If the owner of the service can provide you with the WSDL and other metadata files, you can build a proxy using the ServiceModel Meatadata Utility Tool (SvcUtil.exe) ; 如果服务的所有者可以为您提供WSDL和其他元数据文件,则可以使用ServiceModel Meatadata Utility Tool(SvcUtil.exe)构建代理; otherwise they may have alternative approaches you can use.
否则他们可能会使用其他方法。
That of course, assumes that this service is intended for public consumption. 当然,假设此服务旨在供公众使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.