【问题标题】:RateService not defined with FedEx WSDL in VB.NETRateService 未在 VB.NET 中使用 FedEx WSDL 定义
【发布时间】:2012-12-27 06:10:15
【问题描述】:

我在 Visual Studio 2007 中使用 VB.NET。我正在尝试使用 FedEx WSDL 将 FexEd 评级服务集成到我公司的一个网站中。据我所知,我与 WSDL 的连接/集成似乎工作正常(第一次使用 WSDL),因为它没有抱怨未定义的方法等。

例外情况是,当我尝试创建 RateService 的新实例时,出现错误

“未定义类型‘费率服务’。”

我使用的声明与 FexEx 提供的示例代码中完全相同的声明 Dim service As RateService = New RateService() 并具有相同的导入语句。

有人能想出我在这门课上遇到问题的原因吗?或者有没有用过fedex服务的可以指点一下?如果您需要更多信息,请随时向我提问,因为我很可能遗漏了一些重要的信息。

提前致谢。

这里是 Urbanlemur 要求的 RateService 构造函数的开头

Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

' 
' This source code was auto-generated by wsdl, Version=2.0.50727.1432.
' 


''' <remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")> _
<System.Diagnostics.DebuggerStepThroughAttribute> _
<System.ComponentModel.DesignerCategoryAttribute("code")> _
<System.Web.Services.WebServiceBindingAttribute(Name := "RateServiceSoapBinding", [Namespace] := "http://fedex.com/ws/rate/v13")> _
Public Partial Class RateService
    Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

    Private getRatesOperationCompleted As System.Threading.SendOrPostCallback

    ''' <remarks/>
    Public Sub New()

【问题讨论】:

  • 如果您分享相关的 sn-p 代码可能会有所帮助,这样人们就可以看到究竟是什么问题。

标签: vb.net wsdl fedex


【解决方案1】:

只是为了验证您是否创建了代理类? (听起来像你这样做,但从来没有伤害过)

Create web service proxy in Visual Studio from a WSDL file

你的网络配置中定义了连接吗?

<applicationSettings>
    <RateWebServiceClient.Properties.Settings>
      <setting name="RateWebServiceClient_RateServiceWebReference_RateService" serializeAs="String">
        <value>##fedex webservice address ##</value>
      </setting>
    </RateWebServiceClient.Properties.Settings>
  </applicationSettings>

【讨论】:

  • 我没有代理类。我创建了它并在我的项目中使用它,但我仍然遇到同样的错误。我之前曾尝试在我的 Web 配置中包含 连接,但我收到一条错误消息“无法识别的配置部分 applicationSettings/RateWebService.Properties.Settings”
  • 您是否有 wsdl.exe 创建的 RateService 构造函数的 sn-p 代码?您是否包括 RateServiceClass 代理的命名空间?
  • 我在原始问题中包含了上面的 RateService 构造函数 sn-p。您的第二个问题的答案可能是“不”,因为我不知道该怎么做。我对 VB.NET 开发非常陌生。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-20
  • 2010-10-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多