Access Web Service on host from Win Mo 6 emulator

Testing web service on emulator

Development Environment:

  • Visual Studio 2008
  • .Net framework 3.5
  • SQL Server Express
  • Data Access: Dataset
  • IIS Server 7

Mobile Simulator Environment:

  • Windows Vista
  • Windows Mobile Device Center 6.1
  • Windows Mobile 6 SDK
  • Microsoft Virtual Machine Network Driver for Vista

This project assumes developer:

  • Has knowledge to create web services in .net
  • Has overview of Windows Mobile
  • Knows how to create Dataset
  • Basic knowledge of SQL server database

Creating my order class with certain properties, say business entities, and a collection, implementing generic list, that will be passed to consumer.

Fill the data table of type Order, filter by customer name. Populate our business class out of order table, and return back to consumer.

Consumer aka Smart Device Application:

Once added/created, right Click on project >> Add Web Reference >> Web Services on the local machine, if you’ve deployed on your local machine.

Note: if it is not accessible, put the whole path like the one below.

I gave the name as ‘ServiceDMgr’.

Designing Form1 – Datagrid for listing Orders, button to get order from service, a status message and text box to accept Customer Name. Can be extended to fill the Customers in a combo (Too lazy to do it, huh!)

Design: Code behind:
The code:<code>ServiceDMgr.OrderService customerOrders = new SmartDeviceProject1.ServiceDMgr.OrderService();customerOrders.Timeout = 2000000;

customerOrders.Url = “;;

lblMessage.Text = “connected: ” + customerOrders.Url;


dataGrid1.DataSource = customerOrders.getOrders(txtCusomerName.Text.Trim());

lblMessage.Text = “Connected. Ready.”;</code>

Change in URL??:Yes, emulator will assume localhost as its own local host, hence, it is necessary to replace it with host IP or name. I recommend use IP address. How to get your host ip? Run Comand > Cmd >> ipconfig. If you want to know more about emulator and host connectivity IPs, visit here.

Running your application on WM 6 Classic:


When  you execute Get Orders Service,the code will try to consume the service, however, since we have not cradled, it will throw an error.

Cradle it:
Test it using Internet explorer: Done:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

Up ↑

%d bloggers like this: