6

在此处输入图像描述

我试图将此 Web 服务集成到我的 asp.net 项目中,但它会弹出此类错误!如果您对此有任何想法,请给我解决方案。关于 oodle Web 服务和 oodle API 的资料非常少见。

试试这个 URL 来了解我的问题 http://api.oodle.com/api/v2/listings?key=TEST®ion=chicago&category=vehicle/car

4

2 回答 2

4

那根本就不是 SOAP Web 服务。这是一个 REST XML 服务。REST 服务不提供 WSDL 形式的自描述元数据。

您需要另一种与服务通信的方式。如果没有可用的 C# 包装器,您可能必须自己编写 url 生成器,并让 .NET Framework 为您将 xml 文档反序列化为编写良好的类(您也可以自己编写)

尝试阅读更多内容:Oddle 开发者中心

编辑: 此外,如果您从 Web 应用程序中下载 XML 文档,则需要考虑几件事。

开发时,请确保以管理员身份运行 Visual Studio 。

当您部署到您的托管服务提供商时,请确保您没有运行Medium Trust,因为这可能会阻止您访问外部 Web 资源。

但是,我仍然无法弄清楚为什么“添加 Web 引用”对话框无法连接到 oodle Web 服务器。检查您的网络设置、防火墙设置等。如果您能够在 Web 浏览器中访问该 URL,您应该能够通过代码下载该文档。

于 2012-01-27T15:33:39.323 回答
4
try
    {
        string url = @"http://api.oodle.com/api/v2/listings?key=TEST&region=chicago";

        WebClient webClient = new WebClient();
        webClient.Encoding = Encoding.UTF8;
        string result = webClient.DownloadString(url);

       }
  catch (Exception ex)
    {
        Response.Write(ex.ToString());

    }

此语句创建异常

   string result = webClient.DownloadString(url);

和异常细节是

   System.Net.WebException: Unable to connect to the remote server ---> 
System.Net.Sockets.SocketException: A connection attempt failed because the connected 
party did not properly respond after a period of time, or established connection failed 
because connected host has failed to respond 192.168.0.101:808 at 
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress 
socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, 
Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, 
IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception 
stack trace --- at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& 
request) at System.Net.WebClient.DownloadString(Uri address) at 
System.Net.WebClient.DownloadString(String address) at _Default.lnkGoTo_Click(Object 
sender, EventArgs e) in d:\MyDemoz\oodleDemo\Default.aspx.cs:line 58 
于 2012-01-31T11:39:52.107 回答