fly12
asked on
Using Web Services from a mobile Device
Hi,
I am having problems using web services from a windows mobile device.
I am currently using VS2008, Standard windows mobile 6.0 SDK, and I have created this on a VM (windows XP) using virtual PC 2007.
So far I have created a web service containing a web method for simple hello world (first code example) and a mobile form calling this method (2nd code example). When I run the application it seems I cannot connect to the service with stack trace:
at System.Net.HttpWebRequest. finishGetR esponse()
at System.Net.HttpWebRequest. GetRespons e()
at System.Web.Services.Protoc ols.WebCli entProtoco l.GetWebRe sponse(Web Request request)
at System.Web.Services.Protoc ols.HttpWe bClientPro tocol.GetW ebResponse (WebReques t request)
at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol.doI nvoke(Stri ng methodName, Object[] parameters, WebClientAsyncResult asyncResult)
at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol.Inv oke(String methodName, Object[] parameters)
at SmartDeviceProject1.Test.S ervice1.He lloWorld()
at SmartDeviceProject1.Form1. menuItem1_ Click(Obje ct sender, EventArgs e)
at System.Windows.Forms.MenuI tem.OnClic k(EventArg s e)
at System.Windows.Forms.Menu. ProcessMnu Proc(Contr ol ctlThis, WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Form. WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Contr ol._Intern alWnProc(W M wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.EVL.En terMainLoo p(IntPtr hwnMain)
at System.Windows.Forms.Appli cation.Run (Form fm)
at SmartDeviceProject1.Progra m.Main()
As I am completely new to this area of development there is probably something straight forward left out.
Let me know if you need any further detail.
Thanks,
Fly12
I am having problems using web services from a windows mobile device.
I am currently using VS2008, Standard windows mobile 6.0 SDK, and I have created this on a VM (windows XP) using virtual PC 2007.
So far I have created a web service containing a web method for simple hello world (first code example) and a mobile form calling this method (2nd code example). When I run the application it seems I cannot connect to the service with stack trace:
at System.Net.HttpWebRequest.
at System.Net.HttpWebRequest.
at System.Web.Services.Protoc
at System.Web.Services.Protoc
at System.Web.Services.Protoc
at System.Web.Services.Protoc
at SmartDeviceProject1.Test.S
at SmartDeviceProject1.Form1.
at System.Windows.Forms.MenuI
at System.Windows.Forms.Menu.
at System.Windows.Forms.Form.
at System.Windows.Forms.Contr
at Microsoft.AGL.Forms.EVL.En
at System.Windows.Forms.Appli
at SmartDeviceProject1.Progra
As I am completely new to this area of development there is probably something straight forward left out.
Let me know if you need any further detail.
Thanks,
Fly12
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace WSExpenses
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
form1.cs
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SmartDeviceProject1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void menuItem1_Click(object sender, EventArgs e)
{
Test.Service1 test = new SmartDeviceProject1.Test.Service1();
test.Url = "http://paul-virtual:1057/Service1.asmx";
label1.Text = test.HelloWorld();
}
}
}
were you able to add the web reference without errors?
ASKER
Hi,
thanks for the quick reply. Yes I can add the web reference without errors, but I am changing it away from localhost as I am currently using the emulator, to paul-virtual the name of my client VM.
Cheers, Paul
thanks for the quick reply. Yes I can add the web reference without errors, but I am changing it away from localhost as I am currently using the emulator, to paul-virtual the name of my client VM.
Cheers, Paul
yes localhost would not be a good idea. also make sure that you can see the server (or vm).
To test without running your app you can open PIE and open the web service. If you can see it then you should have no problems.
To test without running your app you can open PIE and open the web service. If you can see it then you should have no problems.
ASKER
Sorry,
Could you go into a bit more detail in your previous comment. Just to make sure I have not left out any steps.
Cheers
Could you go into a bit more detail in your previous comment. Just to make sure I have not left out any steps.
Cheers
open PIE (pocket internet explorer)
type in http:\\yoururl\yourwebservice.asmx and see if the HelloWorld method is there
type in http:\\yoururl\yourwebservice.asmx and see if the HelloWorld method is there
ASKER
If I cannot navigate to it, what might be possibly wrong?
I have attached my solution, if that helps.
I have attached my solution, if that helps.
right now just the Data access of your PDA
ASKER
What is just Data access? I am new to this, so I do not know all the terms.
Thanks
Thanks
ASKER
Hi,
I have been looking at the web service. It is still running as local host on my main machine. Should this be changed to the machine name? If so how?
I have been looking at the web service. It is still running as local host on my main machine. Should this be changed to the machine name? If so how?
in your project select your web reference and I believe you can change the url for the web service in the properties window.
what i mean by dataaccess is the way you connect to the internet. GPRS,edge,wifi...
what i mean by dataaccess is the way you connect to the internet. GPRS,edge,wifi...
ASKER
Hi,
Thanks for the quick response. Yes I can change the URL, but when I change it to http://myMachineName/service1.asmx it throws up this error:
-------------------------- -
Microsoft Visual Studio
-------------------------- -
There was an error downloading 'http://paul-laptop:4400/Service1.asmx'.
-------------------------- -
OK
-------------------------- -
SO i was therefore wondering if it was possible to change my web service away from local host, as if I browse for it in IE using http://machinename:portnum:service.asmx it does not load, until I have entered localhost instead.
I am using the visual studio emulator, and connecting via active sync 4.5 so it can use my machines connection.
Cheers, Paul
Thanks for the quick response. Yes I can change the URL, but when I change it to http://myMachineName/service1.asmx it throws up this error:
--------------------------
Microsoft Visual Studio
--------------------------
There was an error downloading 'http://paul-laptop:4400/Service1.asmx'.
--------------------------
OK
--------------------------
SO i was therefore wondering if it was possible to change my web service away from local host, as if I browse for it in IE using http://machinename:portnum:service.asmx it does not load, until I have entered localhost instead.
I am using the visual studio emulator, and connecting via active sync 4.5 so it can use my machines connection.
Cheers, Paul
Try to enter the URL on your PDA not on your computer
ASKER
Yeah I have been, just tried it on IE as well.
On PIE it throws up the following error message:
Your internet connection is not properly configured. Please verify your setting in connections.
I can surf to other pages on the www.
On PIE it throws up the following error message:
Your internet connection is not properly configured. Please verify your setting in connections.
I can surf to other pages on the www.
you can see google?
ASKER
Yes I can see google
and when you put this url http://paul-laptop:4400/Service1.asmx in your pda what happens
ASKER
It gives the message:
Your internet connection is not configured properly. Please verify your settings in connections.
Cheers, Paul
Your internet connection is not configured properly. Please verify your settings in connections.
Cheers, Paul
ASKER
Same error, and I also took out the Service1.asmx and again the same error.
Cheers, Paul
Cheers, Paul
how is your PDA connected to the internet
ASKER
As far as I am aware it is through the Active Sync 4.5, but I could be wrong. As there a simple way to find out
so your pda is connected to your computer via usb?
ASKER
It is an VS emulator, and i have changed the setting from within active sync to allow connections from DMA
ASKER
Hi,
Yes the IP address is working. Does that mean the phone cannot work out the DNS for phone is not working correctly?
Cheers, Paul
Yes the IP address is working. Does that mean the phone cannot work out the DNS for phone is not working correctly?
Cheers, Paul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is this a known bug? Or just one with my app?
its a known one. Others have the same problem
ASKER
Thats great, cheers for your help
np