以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  关于webservice问题求教  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=158631)

--  作者:s111321
--  发布时间:2020/11/27 10:19:00
--  关于webservice问题求教
1、地址:"http://www.webxml.com.cn/WebServices/WeatherWebService.asmx"
2、vs使用服务引用
     Imports ClassLibrary10.ServiceReference1
     Public Class Class1
        Public Function getWeatherbyCityName(ByVal city As String) As String()
            Dim tq As New ServiceReference1.WeatherWebServiceSoapClient()
            Return tq.getWeatherbyCityName(city)
        End Function
     End Class
3、修改Foxble.exe.config
         <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="WeatherWebServiceSoap" />
            </basicHttpBinding>
            <customBinding>
                <binding name="WeatherWebServiceSoap12">
                    <textMessageEncoding messageVersion="Soap12" />
                    <httpTransport />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx"
                binding="basicHttpBinding" bindingC
                c name="WeatherWebServiceSoap" />
            <endpoint address="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx"
                binding="customBinding" bindingC
                c name="WeatherWebServiceSoap12" />
        </client>
    </system.serviceModel>
4 FT引用
Dim dl As new ClassLibrary10.Class1()
Dim str() As String = dl.getWeatherbyCityName("杭州")

报错:无法加载协定为“ServiceReference1.WeatherWebServiceSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。

--  作者:有点蓝
--  发布时间:2020/11/27 11:01:00
--  
服务引用要使用低版本的用法,按照下面图片顺序设置


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:2.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:3.png
图片点击可在新窗口打开查看

vs里代码
     Public Class Class1
        Public Function getWeatherbyCityName(ByVal city As String) As String()
            Dim tq As New cn.com.webxml.www.WeatherWebService
            Return tq.getWeatherbyCityName(city)
        End Function
     End Class

--  作者:s111321
--  发布时间:2020/11/27 11:16:00
--  
Foxtable.exe.config 这个里面需要添加吗?
--  作者:有点蓝
--  发布时间:2020/11/27 11:17:00
--  
不需要添加
--  作者:s111321
--  发布时间:2020/11/27 12:02:00
--  
可以了,多谢老师