Pocket PC/Webservices: Unable to connect to the remote server

I have developed a Pocket PC 2003 app in Visual Studio .NET and am getting an unusual problem i can't get to the bottom of.

My VB.NET Pocket PC App tries to call a simple web method on my webservice from the device using the webserver's IP or Machine name and receives the error "Unable to connect to the remote server".

Yet if i point the device's IE browser to the location of the webservice asmx file (i.e. http://192.168.1.1/mywebservice/testwebservice.asmx) i can successfully see the WebService name and the supported operations in the devices browser window.

I can confirm that the web reference url within my VB.NET PPC project is exactly the same reference as the test in the browser url (http://192.168.1.1/mywebservice/testwebservice.asmx).

Has anyone any suggestions as to why this may be occuring

 P.S. This works fine on the emulator.

UPDATE: I have created a very simple webservice that does not involve any server side DLL as i was concerned this may somehow be concealing the real error. All the webmethod does now within my test webservice is return the the string "OK".  I still receive the same error when trying to present the return of DoTest() in a messagebox.

The webservice method is as follows:

<WebMethod()> _

Function DoTest() As String

Return "ok"

End Function

I've not actually got my webservice running on a webserver, it is on my laptop and i'm accessing it from my Pocket PC device using the laptops IP/Machine name. Could that cause this problem I don't see why as I can browse to the webservice in the Pocket IE browser.

I'm totally stuck at this point and on the verge of using one of my 2 precious MSDN support calls to microsoft, so PLEEAASSEEE help if you have any suggestions.

Many thanks in advance,

Stew

 



Answer this question

Pocket PC/Webservices: Unable to connect to the remote server

  • mralbert

    Certainly. This is how i call it from the PPC application (I do it exactly the same way in the WinForms application which performs perfectly). My WebReference is named ServerWebService and the webservice it is calling is named TestWebService.asmx:

    Private mobjTestWebService As ServerWebService.TestWebService

    mobjTestWebService = New ServerWebService.TestWebService

    Dim sReturnValue as string

    sReturnValue = mobjTestWebService.DoTest()

    msgbox(sReturnValue)

    Any help Cheers.


  • willis3000

    Could you post the code bit from your PPC application where you create the web service connection and call the function
  • snowjoe

    Cheers Tom and Ilya....you're both bloody legends!!!

    This has resolved my problem...can't thank you both enough. Can finally sleep at night again!!!

    Thanks again,

    Stew


  • YummySatay

    Your assumption is correct, NETCF does not read any properties like WS URL or connection strings from configuration file. It's up to you to read and set them as needed in your code.



  • Richard Turner

    Cheers Tom, I'll give it a try. What makes this more painstaking is that i'm designing on the emulator, and my customer is in the UK (I'm in New Zealand). They are using an actual Pocket PC device so to test any modifications, i have to forward a new cab file to them and wait for them to test it...OH JOY!!! haha

    I'd be surprised if it fixes the problem as i've got the Web Reference URL property set to their web server under my web reference which seems to work fine in my WinForms app, but maybe Pocket PC ignores it or something.

    I've got the URL Behaviour property of the web reference set to Static rather than dynamic....could that affect things somehow

    Anyway, thanks for your assistance mate...I'll let you know how things go.

    Cheers,

    Stew


  • Atul.Langote

    Have a look at http://dotnetremoting.com
    Much faster than webservices and bidirectional

  • JH2

    I think you forgot to set the web service URL in the code. Add this after your web service constructor:

    mobjTestWebService.Url = "<address of webservice>"


  • Pocket PC/Webservices: Unable to connect to the remote server