Step-by-Step windows mobile development (5) Data Interaction between mobile applications and WebServices

Source: Internet
Author: User
Document directory
  • Previous issues:
  • This article briefly introduces
Previous issues:

In terms of database usage, egmkang and ruixuenian have given a lot of suggestions. I have also tested the use of SQLite. In terms of SQL Server CE query, the egmkang performance test code has also been run. Thank you for your help.

 

This article briefly introduces

In addition to data interaction with the local SQL Server CE, windows mobile applications can also communicate with remote WebServices. This process is basically similar to winform development, we can first create a solution, including a windows mobile Application project and a web site, where the web site only needs to add a webservice page. Here, the default page is used, this service has only one default internal method Helloworld. When the windows mobile Application calls this method, it can receive hello, world!

Step 1 create a webservice and a windows mobile Application

There is only one simple method helloworld () in werservice ();

Step 2: Add a web reference to the windows mobile Application. The default reference name is

After adding a reference, add a button on the default Form1 to trigger a webservice event. You can add the following call code in the Click Event of the button:

Private void button#click (object sender, EventArgs e)
{
Localhost. Service ws = new SmartDeviceProject1.localhost. Service ();
MessageBox. Show ("Message From webservice:" + ws. HelloWorld ());
}

In this way, the test is completed, but there is a problem here, that is, the code in webcast is found when searching for materials, and the webservice address is not:

Http: /localhost: 4534/WebSite2/WebService. asmx

But:

Http: /wengyuli: 4534/WebSite2/WebService. asmx

That is to say, this webservice address uses the PC name, not localhost, But I have tested both of them, but both of them fail to be called. Please let me know. Thank you.

 

Solution:

If the network card is bound to the original, if all are set by default, the simulator IP address is the same as the host IP address, so you only need to replace the simulator IP address. Of course, you can also access it by using the machine name, such as http: // wengyuli/website1/webservice. asmx, but cannot be accessed through localhost.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.