Web Service issues

  • Thread starter Christian Donner
  • Start date
C

Christian Donner

T-Mobile Shadow
Windows Mobile 6 Standard
2 GB SD card

I am writing a CF application that consumes a web service which resides on
my server at home. This server is different from the development machine.
The web service URL uses a DynDns domain and port 8080, which is forwarded
by my pix firewall to port 80 on the server, i.e.

http://Dyndnsname.net:8080/Webservicename

gets forwarded to

http://Dyndnsname.net/Webservicename


The server's domain is getting resolved by a hosts file entry on the
development box, but does not resolve in the internal network otherwise. The
first URL that uses port 8080 would not work at all for this server on the
internal network.

Here is the weird thing. When I deploy to the device, I can debug and run
the application on the device and it works like a charm. The web service is
found, using the external URL with port 8080. I can hit the service from IE
on the device, too, and get the info page.
As soon as I unplug the USB cable, the app stops working. The same running
instance starts getting SOAP exceptions or timeouts. If I start a new
instance while disconnected, I get an unspecific error and have not been
able to capture the exception yet. But: I can still hit the webservice page
with IE and get the same results as I did when the USB cable was connected
and the device was controlled by ActiveSync. What's going on? What changes,
connectivity-wise, when I disconnect the device, that affects a custom app,
but not IE?
 
C

Christian Donner

And while I am not sure it matters, here is the rest of the stack:

- VS 2006
- CF 2.0
- ActiveSync 4.5
 
D

Dominik Gallus

Well, I think it works while debugging, because the connection you have
there is already in the internal network (somebody correct me if >I am
wrong).

All I can say is that I had the same problems with reaching an IIS
Server (on my Home PC behind a router) from outside. If i called the
server from network it did work out and i think same is happening to you.

Did test different settings (IIS and Router), nothing worked out,
something is wrong.

Bye,
Dominik
 
D

Dominik Gallus

Well, I think it works while debugging, because the connection you have
there is already in the internal network (somebody correct me if >I am
wrong).

All I can say is that I had the same problems with reaching an IIS
Server (on my Home PC behind a router) from outside. If i called the
server from network it did work out and i think same is happening to you.

Did test different settings (IIS and Router), nothing worked out,
something is wrong.

Bye,
Dominik
 
C

Christian Donner

What you are saying is trivial, but
- I cannot be hitting the server through the inside network, because it does
not listen on port 8080. I must be coming in via the Edge network through
the firewall, even when the device is on ActiveSync (unless I am
misunderstanding what ActiveSync does)
- I can always hit the web service on port 8080 using IE

I am actually getting a System.Net.Webexception, but because I cannot use
the debugger (it works fine when the device is plugged in), this is a pain
to pin down.
 
C

Christian Donner

Interesting - I am indeed coming in through the local network when connected
to ActiveSync. I clearly see this in the IIS log:

2008-01-05 03:30:19 W3SVC259463726 10.10.1.110 POST
/CurrentTemperatures.asmx - 80 - 10.10.1.176
Mozilla/4.0+(compatible;+MSIE+6.0;+MS+.NET+CF+Web+Services+Client+Protocol+2.0.7045.0)
200 0 0

10.10.1.176 is the development box that the device is connected to.

But my WS URL is http://Dyndnsname.net:8080/CurrentTemperatures.asmx

So it seems that the some component along the way is stripping out that port
information, and that I am probably not getting in through the firewall when
disconnected.
 
C

Christian Donner

I got it working, and it was indeed related to the port number disappearing
from the URL. In my web.config, the URL string has the port. When I
inspected the URL property of the soap client before the request, the port
was gone. I now set the URL explicitely in the code and it works as
expected: the application hits the web service when I am not connected (on
port 8080 through the firewall). When I am connected via USB cable, the
request fails, also as expected.
 
C

Christian Donner

One more posting about this - the reason for this is was a really stupid
oversight on my part.
The URL (not in the web.config, of course, as I said previously, but in the
Web Reference properties) is not being used at runtime. Visual Studio only
uses it to generate various code that it does not show you. Because my web
service is not accessible with the external port from my internal network, I
was unable to "Update the Web Reference" with the correct URL. I ignored
this fact, and the generated code behind the scenes actually did not know
about the external port. There is no good solution to this other than
manually fixing the WS URL in Reference.cs and Reference.map.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top