如何验证Web服务方法中是否缺少一个参数 [英] How can Validate if one parameter is missing in a Web service Method

查看:97
本文介绍了如何验证Web服务方法中是否缺少一个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有下一个问题.
如果我在Web服务中有一个方法并且此方法需要1个参数,但是在我的Web服务中调用的人未正确传递该参数.如果缺少该参数或数据类型格式不正确,我该如何在该函数接受该参数之前对其进行验证?有办法防止这种情况吗?
这里举个例子

Hi Guys, i have the next question.
if i have a method in a Web Service and this method need 1 parameter, but the person who is callin my web service not pass the parameter correctly. how can i validate that parameter before the function take it this if is missing or the datatype is in incorrect formtat? there´s a way to prevent this?
here put an example

<br />
<pre lang="vb">Dim sResult As DataSet<br />
result = WebService.GetInformation("") ''''Here should go the parameter, but assuming that the client is not assigned it<br />
</pre><br />
The Next code below is the web service.<br />
<pre lang="vb">Public Function GetInformation(ByVal CodSeguridad As Integer) As DataSet ''''here trow me an Error of dataTpye or if the parameter is missing</pre><br />



预先感谢.



thanks in advance.

推荐答案

对此没有内置支持,但是这两篇文章可能会为您指明方向:

http://msdn.microsoft.com/en-gb/magazine/cc164115.aspx [ ^ ]

http://msdn.microsoft.com/en-gb/magazine/cc164100.aspx [ ^ ]
There is no in built support for this, but wthese two articles might give you a direction:

http://msdn.microsoft.com/en-gb/magazine/cc164115.aspx[^]

http://msdn.microsoft.com/en-gb/magazine/cc164100.aspx[^]


这篇关于如何验证Web服务方法中是否缺少一个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆