国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

Data Integrity in Web Services (轉(zhuǎn)二)

2024-07-21 02:25:02
字體:
供稿:網(wǎng)友
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;
    pd.lastname = lastnamefield.text;
    pd.yearsexperience = int32.parse(yearsexperiencefield.text);
    try
    {
        ps.setpersondata(pd);
        messagebox.show("person set");
    }
    catch(exception exx) { messagebox.show("error setting data:"+ exx); }
}



to drive the point home as to what vs.net is doing with the web service, double click on the persondata struct in the classview of your application.


taking a look around inside the class viewer is an excellent way to find out exactly what kinds of wrappers vs.net is creating for differant things you might be doing and will generally give you an excellent idea of what to expect from your remote objects.


web services are one of the hottest technologies going right now but there are a number of pitfalls that any programmer must be aware of. data integrity is important for any object's proper functioning and must be assured or it could corroupt a larger program and generate a very difficult to trace error. by using the techniques in this article you can keep your objects safe and your data assured.

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 巧家县| 波密县| 丹阳市| 大洼县| 胶南市| 大宁县| 镇安县| 连城县| 宁陕县| 加查县| 阜城县| 东乡县| 丰都县| 瑞丽市| 革吉县| 龙胜| 盐亭县| 西峡县| 东明县| 卢湾区| 辽宁省| 毕节市| 日喀则市| 临漳县| 汉川市| 玉门市| 庆安县| 水城县| 堆龙德庆县| 德江县| 石渠县| 榆中县| 普安县| 江门市| 腾冲县| 嵊州市| 华宁县| 两当县| 武城县| 泰州市| 九龙县|