无法连接远程服务器(Web 服务)

发布于 2024-12-29 06:09:14 字数 416 浏览 1 评论 0原文

在此处输入图像描述

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

尝试此 URL 以进一步了解我的问题 http://api.oodle. com/api/v2/listings?key=TEST&region=chicago&category=vehicle/car

enter image description here

I have tried to integrate this web service into my asp.net project but it popups such type of error ! If you have any idea regarding this kindly give me solution. There are very rare materials about oodle web services and oodle API.

Try this URL to have more idea about my problem
http://api.oodle.com/api/v2/listings?key=TEST®ion=chicago&category=vehicle/car

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伴随着你 2025-01-05 06:09:14
try
    {
        string url = @"http://api.oodle.com/api/v2/listings?key=TEST®ion=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 
try
    {
        string url = @"http://api.oodle.com/api/v2/listings?key=TEST®ion=chicago";

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

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

    }

This statement creates exception

   string result = webClient.DownloadString(url);

and exception details are

   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 
止于盛夏 2025-01-05 06:09:14

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

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

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

编辑:
另外,如果您从 Web 应用程序中下载 XML 文档,则需要考虑一些事项。

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

当您部署到托管提供商时,请确保您没有运行中等信任,因为这可能会阻止您访问外部网络源。

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

That simply isn't a SOAP Web Service. It's a REST XML service. REST services do not provide self-describing meta data in the form of WSDL.

You need another way of communicating with the service. If there isn't a C# wrapper available, you will probably have to write the url generator yourself, and have the .NET Framework deserialize the xml documents for you into nicely written classes (that you, also, write yourself).

Try reading more at: Oddle Developer Center

EDIT:
Also, if you are downloading the XML document from within a web application, there are a couple of things you need to consider.

When you are developing, make sure you are running Visual Studio as an Administrator.

When you deploy to your hosting provider, make sure you are not running Medium Trust, because that might stop you from accessing external web sources.

But still, I can't figure out why the Add Web Reference dialog can't connect to the oodle web server. Check your network settings, your firewall settings and so on. If you are able to visit the URL in your web browser, you should be able to download the document through code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文