最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Data Integrity in Web Services (转二)
时间:2022-07-02 11:19:07 编辑:袖梨 来源:一聚教程网
Although you can create any client you desire for the web service, in this example I have chosen to create a Windows Application. To do so, simply go to File->New Project and choose Windows Application. Drag and drop the items on the form to look something like the figure below.
Now choose Project->Add Web Referance and in the bottom left of this dialog box choose "Web Referances on Loacal Web Server". Choose the Web Service we created in step one, then click on OK.
Below is the event handler code for the two buttons of the application. The rest of the code required for the application should be autogenerated by the form builder. Also note you'll need to include the namespace of the web service in order to use the wrapper objects. It should look something like "using WindowsApplication1.localhost;", but you can find out the exact namespace from the Class View->localhost->PersonService. Look at the top of this code file and see what namespace VS.NET gave this wrapper.
private void GetterButton_Click(object sender, System.EventArgs e)
{
PersonData pd = ps.GetPersonData();
FirstNameField.Text = pd.FirstName;
LastNameField.Text = pd.LastName;
YearsExperienceField.Text = ""+ pd.YearsExperience;
}
private void SetterButton_Click(object sender, System.EventArgs e)
{
PersonData pd = new PersonData();
pd.FirstName = FirstNameField.Text;
Now choose Project->Add Web Referance and in the bottom left of this dialog box choose "Web Referances on Loacal Web Server". Choose the Web Service we created in step one, then click on OK.
Below is the event handler code for the two buttons of the application. The rest of the code required for the application should be autogenerated by the form builder. Also note you'll need to include the namespace of the web service in order to use the wrapper objects. It should look something like "using WindowsApplication1.localhost;", but you can find out the exact namespace from the Class View->localhost->PersonService. Look at the top of this code file and see what namespace VS.NET gave this wrapper.
private void GetterButton_Click(object sender, System.EventArgs e)
{
PersonData pd = ps.GetPersonData();
FirstNameField.Text = pd.FirstName;
LastNameField.Text = pd.LastName;
YearsExperienceField.Text = ""+ pd.YearsExperience;
}
private void SetterButton_Click(object sender, System.EventArgs e)
{
PersonData pd = new PersonData();
pd.FirstName = FirstNameField.Text;
相关文章
- 《燕云十六声》配置要求介绍 12-25
- 《燕云十六声》搬砖介绍 12-25
- 时空中的绘旅人天宇之间怎么玩 绘旅人天宇之间活动玩法介绍 12-25
- QQ2024年度报告怎么看 2024qq年度报告玩法介绍 12-25
- 归龙潮珠砂什么时候up 归龙潮红缘绮梦卡池介绍 12-25
- 王者荣耀S38赛季有什么更新 12-25