Why do iOS web service calls require an IP address? - asp.net

I have some iOS 5 code that I am using to interface to an ASP.NET web service. The code can (seemingly) connect OK to my service but a blank reply is sent every time. I have stepped through the code and saw how iOS takes the service domain address and turns it into an IP address and tests for connection. Does it also use the IP address for a connection when running? The problem is that I have my service running on a shared ASP.NET box so mysite.com/mywebservice.asmx will resolve while an ip address like xxx.xxx.xxx.xxx/mywebservice.asmx will not resolve at all. Could this be the root cause of why my web request is blank every time?

I'm guessing your web site has a registered domain name which is auto-mapped to an IP . Therefore, according to a similar issue that we faced earlier, you need to analyze the full request that is being sent . Tools like - firebug http://getFirebug.com , poster https://addons.mozilla.org/en-US/firefox/addon/poster/ can be really handy for the same.
The issue I faced was solved by changing the "user-agent" header in the request from the IOS device.
So you can replace the value of the header you send with the one that is sent from the browser. Also, there can be some cookies being sent by the browser as a default behaviour.
I think those would be good directions to look, considering the web service you hit gives a reply to the browser.

Related

Need to intercept & redirect http requests because IP for site is invisible from test machine yet the webserver is accessible from an internal address

I need to access a website we have from a machine that isn't able to see the external IP of the webserver. All http requests are of the form http://a.b.c.d/sitelauncher/sitelauncher.aspx and fail to see the site since that IP is inaccessible, yet the webserver happens to be on the local network. How can I somehow intercept and replace so all requests are of the form http://192.168.x.y/sitelauncher/sitellauncher.aspx
Silverlight is required on the client side in case this helps although have no access to source.
Is there some tool available that would permit some kind of string replacement on each occasion an http request is made?
Have tried a thing called rinetd which complains because it can't bind to the original IP target:port (no surprise since it'll be invisible).
Any ideas folks?
Cheers
Iain

Unable to connect to webservice using Chrome Advanced REST Client but able to connect through chrome browser

I need to connect to a third party webservice. When I hit the link directly in the chrome browser, I am able to connect to it and I get a response. But when I tried the same using Advanced REST Client app of chrome, I get a message as 'The service's server DNS address could not be found.'
Also, when I tried to connect it via my JAVA code, using spring's rest template, am getting an Unknown host exception. What could be the reason that am able to connect via browser but not otherwise?
Thanks in advance.
Maybe it's a problem with your system's DNS settings? I'm not sure how Chrome handles queries to DNS when primary DNS did not found the record. If it uses Google DNS' then Chrome may connect to the service but other applications can't.
To test it set your DNS to 8.8.8.8 and check if apps start working.
From browser it's working properly but not from rest client or application, then i guess the problem with the proxy.
if you are using your office network, then this issue will come.
Try hitting the webservice by connecting to personal network.
i have faced similar issue last week, from browser and postman i'm able to hit the web service but not from the application.
Ones i connected with my personal then it started working.
Hope it helps.

IP address issue when deployed in Server

I have a Servlet project developed using Tomcat 7.
My projects logic is that whenever a request comes from certain IP it responds to the same IP with a new instance of browser as an response.
When I run and test this application locally it works perfect and by the way my local working IP address will be something like this 10.52.xxx.xxx. So request has 10.52.xxx.xxx and response is given to 10.52.xxx.xxx and all happies
Now things looks perfect and I planned to deploy this project in a Server which has an IP addess of 172.32.xxx.xxx and I have completed deployment of the same.
Now the issue which I am facing is that when I try to make a request to the project in the server (172.32.xxx.xxx) from my network (10.52.xxx.xxx).
In my project I have code like
String ip = request.getRemoteAddr(); //gets request IP address to give a new instance of browser
Now the variable ip contains an IP address of 172.32.xxx.xxx. So my code will try to give a browser instance to 172.32.xxx.xxx which doesn't exist. It should ideally give the browser instance back to 10.52.xxx.xxx as this is from which it had received the request so it has to respond to this IP.
I know both Server and the client request are in different IP network but I would like to know all possible solutions to fix the same so that browser is given back to 10.52.xxx.xxx.
Any help highly appreciated.

Fiddler shows DNS Lookup failure

On my desktop I run Visual studio web server cassini and fiddler as a proxy, then I connect to a web site running in Cassini using an iPad connected via wireless.
This has always worked since I installed and unistalled the MVC pack for visual studio.
Now I get this message from fiddler (it is sent to the iPad):
[Fiddler] DNS Lookup for "http://175.33.22.116" failed. The requested name is valid, but no data of the requested type was found
There are similar posts with this message, but none of them with my setup.
Can you suggest what to check?
Thank you
This indicates that the traffic from your IPAD client is malformed. Are you using anything in Fiddler (e.g. Tools > HOSTS) to change the traffic? If not, the bug is on the client; e.g. something is trying to connect to http://http://175.33.22.116 which isn't legal (due to the double http:// within the string).

What exactly happens when you instruct your browser to go to a webpage?

I have some knowledge on my question but not exactly. What exactly programatically happening after http request?
Scott Hanselman said in one of his blog posts:
Describe, in as much detail as you think is relevant, as deeply as you can, what happens when I type "cnn.com" into a browser and press "Go".
My question is exactly this,
That's like asking "describe how to perform a coronary bypass". Yes, one can explain how, but one is better first studying medicine and learning about the basics, before starting with specific procedures. However, in bulletpoints:
Your browser will want to know the IP address of cnn.com. It doesn't do DNS lookups itself, but rather asks the operating system.
Your browser will connect to that IP address on port 80
Your browser will send a HTTP GET request
The webserver will reply with statuscode 200 and the body contents
Your browser will parse the HTML
In the HTML, other resources (images, scripts, css-files...) might be included, which the browser will also fetch.
After the browser is done, it will close the connection. If it doesn't, the webserver will.
Browser tries to resolve the name cnn.com into its ip address.
Browser TCP connects to cnn.com's ip address on the default HTTP port (80)
Browser sends a GET request to the server, asking for the / page
Browser says that it's trying to connect to "cnn.com" (cnn.com and bbc.com could be hosted on the same hosting company, with the same IP address)
Browser also says what's your browser, browser engine, browser version, operating system and the plug-ins that you have installed.
Server sends a header saying what's coming on your reply, the kind of data you're going to receive (in this case, HTML), and the size of the response if it's available.
Server closes the connection if there isn't any keep-alive instruction from the browser. Otherwise it will use this opened connection to ask for other things that might be needed (images within the page, for example.)
By the way, download and install Wireshark if you want to go deep and see what's really going on behind the curtains.

Resources