1.首先了解Web Service服务
  1) Web Services 是一种构建应用程序的普通模型,并能在所有支持 Internet 通讯的操作系统上实施运行。Web Services 令基于组件的开发和 Web 的结合达到最佳,基于组件的对象模型,如:Distributed Component Object Model(DCOM)、Remote Method Invocation(RMI),Internet Inter-Orb Protocol(IIOP)都已经发布了很长时间了,但是这些模型都依赖于特殊对象模型协议,而 Web Services 利用 SOAP 和 XML对这些模型在通讯方面作了进一步的扩展以消除特殊对象模型的障碍。
Web Services 主要利用 HTTP 和 SOAP 协议是商业数据在 Web 上传输,SOAP通过 HTTP 调用商业对象执行远程功能调用,Web 用户能够使用 SOAP 和 HTTP通过 Web 调用的方法来调用远程对象.
2)对Web Services的详细讲解来源博客:
3)Web Services的教程:
 
2.添加引用Web Service服务
1)应用调用的手机号码归属地查询的web service接口为:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 
2)添加Web Service服务
图片暂时没有传上
 
3.后台的调用web service服务
private void Search_Click(object sender, RoutedEventArgs e)
        {
            //实例化一个web service代理的对象
            MobileReference.MobileCodeWSSoapClient proxy = new MobileReference.MobileCodeWSSoapClient();
            proxy.getMobileCodeInfoCompleted +=new EventHandler<MobileReference.getMobileCodeInfoCompletedEventArgs>(proxy_getMobileCodeInfoCompleted);
            //将调用信息包括方法名和参数加入到soap消息中通过http传送给web service服务端 
            //这里对应的是调用了web service的getMobileCodeInfo方法
            proxy.getMobileCodeInfoAsync(TextBox_Phonenumber.Text, "");
        }
        void proxy_getMobileCodeInfoCompleted(object sender, MobileReference.getMobileCodeInfoCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                //显示返回的结果
                TextBlock_INFO.Text = e.Result;
            }
        }
 
4.对控件属性的附加(个人需求)
1)在源码中使用了textbox的 TelephoneNumber属性
<TextBox Name="TextBox_Phonenumber"
                     VerticalAlignment="Top"
                     HorizontalAlignment="Left"
                     Height="80"
                     Width="406"
                     Margin="23,112,0,0">
                <TextBox.InputScope>
                    <InputScope>
                        <InputScopeName NameValue="TelephoneNumber"></InputScopeName>
                    </InputScope>
                </TextBox.InputScope>
            </TextBox>
 
2)对textbox属性的详解,来源博客: