winfrom调用webservice~
这几天看wrox的 C# web 服务器编程,看的晕晕乎乎,为了目标,实现一个聊天软件,还是坚持看了些,做一个Demo,只是web service+winfrom,然后,上代码~
代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DY_web.HelloWeb;
using DY_web.MobileCodeWS;
namespace DY_web
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Service1SoapClient s = new Service1SoapClient();
//textBox1.Text=s.HelloWorld(); //调用本地的
//ncu.UpLoadFileSoapClient u = new DY_web.ncu.UpLoadFileSoapClient();
//u.MakeImage("de"); //测试
MobileCodeWSSoapClient m = new MobileCodeWSSoapClient();
textBox1.Text = m.getMobileCodeInfo("***********", ""); //网上找的一个手机号查询的
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DY_web.HelloWeb;
using DY_web.MobileCodeWS;
namespace DY_web
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Service1SoapClient s = new Service1SoapClient();
//textBox1.Text=s.HelloWorld(); //调用本地的
//ncu.UpLoadFileSoapClient u = new DY_web.ncu.UpLoadFileSoapClient();
//u.MakeImage("de"); //测试
MobileCodeWSSoapClient m = new MobileCodeWSSoapClient();
textBox1.Text = m.getMobileCodeInfo("***********", ""); //网上找的一个手机号查询的
}
}
}
调用出了点问题 ,上网查了查,将一个节点注释了,如下:
项目结构如图:
下一步想尝试一下Remoting体系,祝自己好运~