【问题标题】:Missing Functionality after loading WSDL in Visual Studio 2019在 Visual Studio 2019 中加载 WSDL 后缺少功能
【发布时间】:2021-07-16 17:11:11
【问题描述】:

我正在尝试使用 Visual Studio 2019 在 C# 中实现与 DB Schenker 的连接。但是,在 Visual Studio 2019 中加载 WSDL 后,无法像以前那样创建响应对象。 (例如 response = webclient(registration, orderdetails))我注意到 Visual Studio 没有将所有操作都转换为函数。缺少 getBookingRequestLand() 和 getBookingResponseLand() 函数,可能还有其他函数。

Visual Studio 是否有可能没有将 WSDL 完全翻译成代码?如何创建请求?

【问题讨论】:

标签: c# api soap wsdl visual-studio-2019


【解决方案1】:

请检查他们是否有任何与“getBookingResponseLand”相关的“操作”标签名称

示例:https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

有方法名称“NDFDgenByDayLatLonList”所以它看起来像

<operation name="NDFDgenByDayLatLonList">
<documentation>Returns National Weather Service digital weather forecast data. Supports latitudes and longitudes for the Continental United States, Hawaii, Guam, and Puerto Rico only. The latitude and longitude are delimited by a comma and multiple pairs are delimited by a space (i.e. 30.00,-77.00 40.00,-90.00). Allowable values for the input variable "format" are "24 hourly" and "12 hourly". The input variable "startDate" is a date string representing the first day (Local) of data to be returned. The input variable "numDays" is the integer number of days for which the user wants data. Allowable values for the input variable "Unit" are "e" for U.S. Standare/English units and "m" for Metric units.</documentation>
<input message="tns:NDFDgenByDayLatLonListRequest"/>
<output message="tns:NDFDgenByDayLatLonListResponse"/>
</operation>

带有命名空间的一些时间操作元素

<wsdl:operation name="getSearchKeywordsRecommendation">
            <soap:operation
                soapAction="http://www.ebay.com/marketplace/search/v1/services/getSearchKeywordsRecommendation"/>
            <wsdl:input>
                <soap:body
                    use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body
                    use="literal"/>
            </wsdl:output>
        </wsdl:operation>

如果您使用的是 VS2019,您只需点击服务并选择“更新...”

步骤 更新项目 Web 参考

  1. 在解决方案资源管理器中,打开项目的 App_WebReferences 文件夹,然后单击要更新的 Web 引用的节点。
  2. 右键单击参考,然后单击更新 Web 参考。

XML Web 服务的新文件被下载到您的项目中。 XML Web 服务的信息在您的项目中更新。

【讨论】:

  • 我已将 wsdl 添加到问题中,对我来说,标签似乎没问题
  • 请再次查看 没有找到“getBookingResponseLand”的操作名称
  • 我认为它不能公开访问?
  • 很遗憾不是。
【解决方案2】:

我无能为力 =(。您必须创建一个包含接口的客户端,该接口然后包含请求方法,然后您可以创建一个请求。将其分配给一个变量,您就有一个响应对象。

【讨论】:

    猜你喜欢
    • 2019-11-30
    • 2020-11-07
    • 2019-09-03
    • 2021-08-26
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 1970-01-01
    • 2015-10-24
    相关资源
    最近更新 更多