大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> NET专区 -> Data Integrity in Web Services (转二)

Data Integrity in Web Services (转二)

时间: 2021-07-31 作者:daque

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.

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.