c# - UPS API .Net 添加 Web 引用

标签 c# asp.net api wsdl ups

在这里使用 API 包:https://www.ups.com/gec/techdocs/pdf/Rates_Pkg_Gnd.zip

通过以下方式添加对 RateWS.wsdl 的引用:

-右键点击网站项目->添加服务引用

-在地址栏输入:file://C:\Users\MyUser\Desktop\UPS API\RatingPACKAGE\PACKAGEWebServices\SCHEMA-WSDLs\RateWS.wsdl

Visual Studio 添加了几个引用文件:

enter image description here

使用API​​包中提供的示例代码,我将测试代码复制到我的项目中。

问题:未定义“RateService”类。缺少引用?

enter image description here

似乎未正确添加 Web 引用。 RateService 类是未知的。感谢您的帮助。

最佳答案

我认为问题在于您正在尝试添加服务引用而不是 Web Reference :

To add a Web reference to a project In Solution Explorer, right-click the name of the project that you want to add > the service to, and then click Add Service Reference. The Add Service Reference dialog box appears. In the Add Service Reference dialog box, click the Advanced button. The Service Reference Settings dialog box appears. In the Service Reference Settings dialog box, click Add Web Reference. The Add Web Reference dialog box appears. I n the URL box, enter the URL of the Web service to use. If you do not know the URL, use the links in the browse pane to locate the Web service you want.

关于c# - UPS API .Net 添加 Web 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38363503/

相关文章:

c# - 如何在 C# 中更改控制台窗口的完整背景颜色?

c# - 无法在 Core Identity 的 ApplicationUser 中保留关系

c# - 方法在 asp.net 中的页面加载期间触发两次

javascript - 何时以及如何仅在 promise 完成时返回 http 响应?

android - 如何在 Android 中使用 API?

c# - 使用 GetPrivateProfileString 读取所有 ini 文件值

c# - Func<> 的 List<>,具有通用返回类型的编译错误,但为什么呢?

asp.net - ASP.NET 中的双向数据绑定(bind)

html - Internet Explorer 中的字段集图例

c# - 未从 .NET MVC MultipartFormDataContent POST 收到 .NET Core API List<IFormFile> 文件