0

My Compact Framework / Windows CE app, running on a Motorola 3190 handheld device, needs to call a RESTful method in a Web API app.

The handheld devices are connected to a host machine whose IP address can apparently be deduced via:

IPAddress IPAddr = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0];

But if I try to use this to call the server on which the Web API app runs, all Dallas breaks loose

So I'm thinking: do I need the handheld device to attach to its host machine using its IP Address and then from there have another IP Address for the server machine (not the same machine in "real life," but it is the same machine at development time).

IOW, do I need something like:

string uri = string.Format("http://{0}:{1}:28642/Bla/Bla?Bla=Blee&Bloo=Gloo", ActiveSyncHostIPAddress, WebAPIServerAddress);

?

I don't know if that is even "legal" (IPAddress1:IPAddress2) or, if not, how this needs to work.

IOW, the handheld device needs to connect to its host (which is usually at the customer's site) in order to communicate with it. But then that host needs to communicate with the server which contains the app which exposes the RESTful (Web API) methods.

At design time, there are only two players:

Handheld Device => Dev Machine (which is the handheld device's Host and is running the server/Web API app)

...but in the field, there are three players:

Handheld Device => Host on Premises => Server running the Web API app

How is this accomplished without the "Host on Premises" having carnal knowledge of the "Server running the Web API app"?

OR, am I thinking about this wrong, and I just need to connect directly from the handheld device to the Web API server? If so, how can I do that? IOW, can the handheld device / Compact Framework app bypass its host and go straight to its ultimate destination?

Community
  • 1
  • 1
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    "IP1:IP2:port" is not legal URL syntax. It will not do anything for you. If the server is reachable from the mobile device (i.e. not firewalled) you should access it directly. If the "host on premises" is the only thing allowed to talk to the server, you'll need to proxy the calls through it somehow - such as with an actual HTTP proxy server, or by making a wrapper web service that forwards the requests to the server. – nobody Mar 11 '14 at 19:14
  • 1
    On another note, you should not be doing DNS resolution manually without a very good reason. Just use the host name in the URL. – nobody Mar 11 '14 at 19:15
  • Thanks, Doc; there's a related question here: http://stackoverflow.com/questions/22331090/what-uri-pattern-do-i-need-to-communicate-with-my-pc-from-my-handheld-device and as you can see here: http://stackoverflow.com/questions/22306678/why-am-i-getting-unable-to-connect-to-the-remote-server using the raw IP Address fails for me, too (I get a Null Reference Exception; I have a breakpoint at the start of the server method, so it must be happening on the client) – B. Clay Shannon-B. Crow Raven Mar 11 '14 at 20:41
  • According to this post: http://community.appamundi.com/blogs/andywigley/archive/2008/11/24/accessing-restful-astoria-data-services-in-net-compact-framework.aspx by Andy Wiggly (the cat/bloke who wrote "MS .NET Compact Framework"), you *do* use "ppp_peer": HttpWebRequest request = REST.CreateRequest(@"http://ppp_peer/DataServicesWebsite/NorthwindService.svc/Customers", HttpMethods.GET, String.Empty, @"application/atom+xml", "", ""); – B. Clay Shannon-B. Crow Raven Mar 11 '14 at 21:13

0 Answers0