Unable to connect Web Services with Pocket PC 2003 Emulator in vs2005RC

The output window:

A first chance exception of type ' System.IO.FileNotFoundException' occurred in Mscorlib.dll

A first chance exception of type ' System.Net.WebException' occurred in System.dll

A first chance exception of type ' System.Net.WebException' occurred in System.Web.Services.dll

Test of the Web Services in IE is good

How to resolve this problem?

[416 byte] By [fly_eye] at [2007-12-23]
# 1

Are you facing this problem with emulator only?

Can you please let us know a little more what you are trying? A sample code will be really helpful.

-Thanks,

Mohit

MohitGogia at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 2

The code of webservieces:

<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function

The code of client form:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ws As New localhost.Service
txt.Text = ws.HelloWorld
End Sub
End Class

It's very sample so I am puzzled.

fly_eye at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 3

Thanks for reporting us the problem. I have filed a bug on your behalf for further investigation on why these exceptions are showing up.

But i observe that accessing the web service from emulator is working fine. Let me know if you are having any problem with accessing the webservice?

-Thanks,

Mohit

MohitGogia at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 4

How you are adding the web reference?

You have to give the computer name in place of the localhost

Eg, if ur web service is http://localhost/WebService1/Service1.asmx

here replace localhost with your computer name.

I have called web services from emulator and also from Xds 11s pochet pc device.

It worked fine.

Regards,

NavneetSharma at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 5

Thanks for your replies.

To Mohit,

I set a WindowsApplication acess this webservice , it works fine.

The same problem occured through Window Mobile 5.0 emulator.

To Naveet Sharma,

I replace localhost with my computer name or computer's ip address, it doesn't work fine,the information in output windows is the same of above.

fly_eye at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 6

Did you cradled the emulator? You need to cradle emulator to make it working. You can cradle emulator using Device Emulator Manager.

Here is the client code i tried

private void button1_Click(object sender, EventArgs e)
{
localhost.Service service = new DeviceApplication1.localhost.Service();
service.Url = "http://<machine name>:1563/WebSite8/Service.asmx";
string str = service.HelloWorld();
MessageBox.Show(str);
}

-Thanks,

Mohit

MohitGogia at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 7
Mohit Gogia wrote:

Did you cradled the emulator? You need to cradle emulator to make it working. You can cradle emulator using Device Emulator Manager.

Here is the client code i tried

private void button1_Click(object sender, EventArgs e)
{
localhost.Service service = new DeviceApplication1.localhost.Service();
service.Url = "http://<machine name>:1563/WebSite8/Service.asmx";
string str = service.HelloWorld();
MessageBox.Show(str);
}

-Thanks,

Mohit

Of course I did.

The problem occured when I clicked the button.

Thanks a lot

fly_eye at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 8

Hello,

Let me rephrase the question once again

1. You are getting exceptions as you mentioned above

My Comments:- I acknowledge that exceptions are coming as mentioned by you. I have filed a bug on your behalf for further investigation on why those exceptions are coming.

2. Call to web service method from the emulator not working

My Comments:- By using the above client application with a cradled emulator, i can see that few exceptions come as mentioned by you but the call to the web service method works fine (e.g. On button click, the above client application shows messagebox with the correct string as returned from web service.) if you ignore those exceptions and continue.

Hope this helps.

-Thanks,

Mohit

MohitGogia at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 9

Hi,

I am realy surprised to c that still u dint found the soln of ur prob.

I tried to simulate ur problem in my system and found that the soln given by me earliar is the only soln of this problem.

Now i'll explain u step by step wht u hav to do -

After seeing ur code i came to know that u r creating Visual Basic Project, So i'll give u the explaination for that only. As u have created the ASP.NET Web Service just by uncommenting the already written Web Method. Its Ok.

Now you have to call this web service through ur Pocket PC Emulator. Create a new Smart Device Application, choose Pocket PC as the platform and Project Type as Windows Application. Then in the Solution Explorer, right click on the References and add Web References. A seperate window will open up, click on the WebServices on the local machine if the service is on ur machine otherwise give the URL of the concerned machine and select the Web Service u created, its address will appear in the URL something like: http://localhost/WebService1/Service1.asmx

Now replace "localhost" by your "computer name" or by your IP address and click Go. Give any name in web reference name or just write localhost and click on Add Reference.

With your same button click code, this web service will now start working and u'll see Hello World displayed in your textbox.

Regards,

NavneetSharma at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 10

Dear Mohit,

I am unable to connect Web Services with Pocket PC 2003 Emulator in vs2005 in C#, But I can use Web Service with Window application in PC.

I tried to cradle emulator using Device Emulator Manager. Tool->Device Emulator Manager->(Right click on the emulator)->

Cradle, Gray out.

Uncradle Gray out

only I could choice is Connect or Clear Save State.

I am using ActiveSync 4.1 and VS 2005,

I also did following:

In the activesync connection settings, check the "Allow connections to one of the following" checkbox and select from the combo-box below that "DMA".

I am hoping someone to solve my problem, Thanks.

Lisa

# 11

Hi, Navneet!

I read your post.

I'm having the same problem with consumina a web service from an Emulator.

I tried the steps you described above (my Service is hosted on a local machine).

I'm replacing "localhost" with my machine's IP address but it still doesn't work. My computer is in a LAN and has an internal IP adress (so it can't be accessed from outside the LAN). I wonder if this could be the cause of the problem. And if this is true, is there another way I can handle this?

Thanks

olenka at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 12

Hi fly_eye,

I hope that i'll help you. I have the same problem and I solve it like this.

If you like to call web service from Pocket PC 2003 emulator, which is hosted on your local machine, first of all you must change url in Web Reference : MachineName or IP address instead of "localhost".

Second you must install ActiveSync on your PC and start Pocket PC's ActiveSync and choose "Connect via DMA ". This way you will connect your Pocket PC with your PC and after that dialog window will appear where you should choose type of partnership.

Choose Guest Partnership.

That's all folks :)

Crypto_N at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 13

I've got the same problem!

Also, I'm using the HelloWorld Web Service!

All I can say about it is that I've tried all that is said in all posts here and I've not resolve the problem.

Please, if anybody have the sollution to this, my email is jciansp@hotmail.com

Thanks!

jchan at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...
# 14

I've the same problem and I've tried all the possible sollutions in this page and I haven't found why it doesn't work

If anybody find the sollution, please let me know: jciansp@hotmail.com

jchan at 2007-8-30 > top of Msdn Tech,Smart Device Development,Device Emulator General...