【问题标题】:How to connect to WSDL service using Binding Url in .Net如何使用 .Net 中的 Binding Url 连接到 WSDL 服务
【发布时间】:2018-02-02 10:13:09
【问题描述】:

我获得了一个 Web 服务,我需要在我的 MVC 应用程序中使用它。 用户已提供 WSDL 网址: http://abc.xyz.nirp.com:50000/dir/wsdl?p=ic/310c503c873138a884ddd3ee4a5738e6

绑定网址: http://abc123.ad.xyx.com:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_HARMONY_D&receiverParty=&receiverService=&interface=ABC_OS&interfaceNamespace=http%3A%2F%2Fabc.com%2Fhcm%2Fabc

我可以使用 SOAP 凭据使用 WSDL URL 添加服务引用,但我还需要将这些添加到我无法理解的 Web 配置和应用程序配置中。

关于如何使用这个 Binding Url 并将其放入 Web Config 和 App Config 的指针,这对我真的很有帮助。

【问题讨论】:

    标签: c# .net asp.net-mvc soap wsdl


    【解决方案1】:

    检查您的 web.config。添加服务参考后,Visual Studio 在您的 web.config 中添加端点。你可能有这样的部分:

      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="DefaultServiceEndpoint">
              <security mode="None" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="ADDRESS_HERE"
            binding="wsHttpBinding" bindingConfiguration="DefaultServiceEndpoint"
            contract="ServiceReference1.SOME_CLASS" name="DefaultServiceEndpoint" />
        </client>
      </system.serviceModel>
    

    您可以在这里更改地址。

    【讨论】:

    • 所以完整的绑定 URL,我应该添加来代替 'ADDRESS_HERE'?
    • 代替 ServiceReference1.SOME_CLASS ,有什么需要添加的吗?
    • 当您添加服务引用时,这些属性已经具有价值。如有必要,您应该更改的唯一属性是地址。
    • 我没有 wsHttpBinding 标签,但有 basicHttpBinding。
    • 我可以继续使用 basicHttpBindnig 吗?
    猜你喜欢
    • 1970-01-01
    • 2013-04-11
    • 1970-01-01
    • 1970-01-01
    • 2012-10-29
    • 2018-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多