Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable To connect remote server (Web Service)

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&region=chicago&category=vehicle/car

like image 848
Chintan Avatar asked Jan 27 '12 15:01

Chintan


People also ask

How do I fix unable to connect to remote server?

Go to the Start menu and type “Allow Remote Desktop Connections.” Look for an option called “Change settings to allow remote connections to this computer.” Click on the “Show settings” link right next to it. Check the “Allow Remote Assistance Connections to this Computer.” Click Apply and OK.

What does it mean when it says unable to connect to remote server?

This usually means that there is a network or server issue occurring at this moment. Network troubleshooting can help us identify if there is an issue with the connection. Run the following commands to test the network: On your computer's task bar, click on the Start button.


2 Answers

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());

    }

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 
like image 182
Chintan Avatar answered Sep 19 '22 23:09

Chintan


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.

like image 39
Anders Marzi Tornblad Avatar answered Sep 20 '22 23:09

Anders Marzi Tornblad