Log in

View Full Version : Problem in communicating with a web service from SmartPhone App.


gmoulik
04-20-2004, 02:28 PM
Hi All,This is my first post in the forum.

I am developing an application for the smartPhone using .NET compact Framework.
The purpose of the application is it will communicate with a Web Service and show some data.

As I am a newcomer in .NET compact Framework , I have started with a very simple WebService , it has just one routine which adds 2 numbers, I am calling this WebService::routine from the smartphone App, When I am hosting the web Service in Development PC(where I am developing the SmartPhone App) it is working fine but as soon as I am hosting the web Service in another PC,and the smartphone APP tries to communicate with the Remote PC hosted web Service,it is throwing an exception ("Web Exception").

This is how I am creating an instance of WebService and calling the routine.
bbgSmtWbService = new WebReference.Service1();
z = bbgSmtWbService.WebAdd(x,y);

But surprisingly it is working fine with locally hosted Webservice.
Does anybody have any idea what could be the reason ?

Thanks in advance.
Gautam

Kris Kumar
04-21-2004, 05:33 AM
Not an expert in .NET web services...

But since no one has responded wanted to suggest a couple of things..

(assuming you are testing your app using emulator)

1. When you moved the Web Service from dev box to remote box, did you update the Web Reference (URL) to point to the new box. I usually remove the reference and add it to the project again.

2. I believe you are running the app in the emulator. Is the emulator configured to access the network. I mean can you launch pocket IE in the emulator and launch a web page on the remote box.

3. Remote machine, does it have .NET Framework loaded.

4. When you deployed the app on Remote App, did you test the web service in the regular PC browser. Does that work. If not what are the exception details. Also try this in the Pocket IE in the emulator.

gmoulik
04-21-2004, 07:10 AM
Hi Kris ,
First of all thakns for your reply.
Let me comment on your points.

1. When you moved the Web Service from dev box to remote box, did you update the Web Reference (URL) to point to the new box. I usually remove the reference and add it to the project again.

well, I have added a new web reference (given it a different name).

2. I believe you are running the app in the emulator. Is the emulator configured to access the network. I mean can you launch pocket IE in the emulator and launch a web page on the remote box.

Yes the emulator is configured to access network , I am accessing Internet from the browser as well as accessing any local network Machine hosted web application , infact I am able to access the remote machine hosted web service(the .asmx file) thru the browser.

3. Remote machine, does it have .NET Framework loaded.

Yes Offcourse, It does have , I have written a sample windows App(in C#) which access the Remote machine hosted Web Service,and it is working fine.

4. When you deployed the app on Remote App, did you test the web service in the regular PC browser. Does that work. If not what are the exception details. Also try this in the Pocket IE in the emulator.

I think you are talking about the .asmx file , yes it is working fine in both Windows Browser as well as in the emulator browser.

Lastly, I have a doubt on the Authentication, coz I have written the same Application for the Smart Device and I am running the app in Pocket PC Emulator and I am getting an exception
"The remote server returned an error: (401) Unauthorized."
So, I am kind of confused coz 2 emulator raising 2 different types of exception.

Kris Kumar
04-21-2004, 12:46 PM
Hi Gautam,

Hmm, so it seems the web service is working fine (from .asmx test in browser) and its the Smart Device app that has some issues.

One more item on the basic checklist is the Service Pack, I believe there is Service Pack for the .NET CF.

Anyway..I just dug up the official CF forum...
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.framework.compactframework

All the best..
Kris