xmlsoccer.com to sql

本文关键字:sql to com xmlsoccer | 更新日期: 2023-09-27 18:03:17

我正在尝试从' xmlsoccer.com解析XML。

使用这个例子http://xmlsoccer.wikia.com/wiki/.NET_code_example:_Livescore_website

我创建了SQL表,没有犯任何错误。我复制了整个代码,但这段代码仅适用于完全访问用户,但我使用DEMO服务。
private XDocument GetLiveScoreDocument()
{
    XMLSoccerCOM.FootballDataSoapClient serviceClient = new XMLSoccerCOM.FootballDataSoapClient();
    var node = serviceClient.GetLiveScore(apiKey);
    XDocument xmlDoc = new XDocument();
    xmlDoc = XDocument.Load(new XmlNodeReader(node));
    return xmlDoc;
}

我将FootballDataSoapClient改为FootballDataDemoSoapClient并运行网站

XMLSoccerCOM.FootballDataDemoSoapClient serviceClient = new XMLSoccerCOM.FootballDataDemoSoapClient();
    var node = serviceClient.GetLiveScore("My Api");
    XDocument xmlDoc = new XDocument();
    xmlDoc = XDocument.Load(new XmlNodeReader(node));
    return xmlDoc;
程序抛出异常

合同'XMLSoccerCOM '的端点配置部分。无法加载FootballDataDemoSoap,因为找到了该契约的多个端点配置。请按名称指定首选端点配置部分。

我不知道如何修理它。如果你有分析xmlscore.com分数的经验,请帮助我。

xmlsoccer.com to sql

当您为这个web服务添加服务引用时,它会创建两个可能使用的绑定。例如,当我尝试它时,在我的app.config中我得到这个:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="FootballDataDemoSoap" />
        </basicHttpBinding>
        <customBinding>
            <binding name="FootballDataDemoSoap12">
                <textMessageEncoding messageVersion="Soap12" />
                <httpTransport />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://www.xmlsoccer.com/FootballDataDemo.asmx"
            binding="basicHttpBinding" bindingConfiguration="FootballDataDemoSoap"
            contract="ServiceReference1.FootballDataDemoSoap" name="FootballDataDemoSoap" />
        <endpoint address="http://www.xmlsoccer.com/FootballDataDemo.asmx"
            binding="customBinding" bindingConfiguration="FootballDataDemoSoap12"
            contract="ServiceReference1.FootballDataDemoSoap" name="FootballDataDemoSoap12" />
    </client>
</system.serviceModel>

因此,有两种可能的绑定可供选择。它们之间的区别在于,一个被配置为使用Soap1.2,而另一个使用Soap1.1。这里有更多的信息http://www.w3.org/2003/06/soap11-soap12.html,但假设两者都可以工作。

那么这个错误就完全有意义了——它发现了不止一个可能的配置,所以它不知道该采用哪一个。你得说出来。您可以通过使用以绑定配置名称为参数的构造函数重载来实现这一点。例如:

FootballDataDemoSoapClient client = new FootballDataDemoSoapClient("FootballDataDemoSoap");

FootballDataDemoSoapClient client = new FootballDataDemoSoapClient("FootballDataDemoSoap12");`