在Web服务方法的重载 [英] Method overloading in webservices

查看:202
本文介绍了在Web服务方法的重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经与Web服务2的问题。


  1. 我们如何实现方法Web服务超载。

  2. 如何实现Web服务安全性(验证)。


解决方案

好吧超载:

  [的WebMethod(MessageName =MAXINT,说明=比较两个int值
并返回最大值,EnableSession = TRUE)]
公众诠释的MaxValue(INT A,INT B)
{
   回报(A> B A:B);
}
[的WebMethod(MessageName =MAXFLOAT,说明=比较两个浮点值
并返回最大值,EnableSession = TRUE)]
公众持股量的MaxValue(浮动,浮动二)
{
   回报(A> B A:B);
}

你是什么意思认证precisely?可以很明显的使用验证密钥来访问Web服务。现在的问题是混乱。详细请。

I have 2 question related to the web services.

  1. How we achieve the method overloading in web services.
  2. How to implement security(authentication) in web services.

解决方案

Okay for overloading:

[WebMethod(MessageName = "MaxInt", Description = "Compare two int values 
and return the max value", EnableSession = true)]
public int MaxValue(int a, int b)
{
   return (a > b ? a : b);
}
[WebMethod(MessageName = "MaxFloat", Description = "Compare two float values 
and return the max value", EnableSession = true)]
public float MaxValue(float a, float b)
{
   return (a > b ? a : b);
}

What do you mean precisely by authentication? You can obviously use a validation key to access webservice. The question is confusing. Elaborate please.

这篇关于在Web服务方法的重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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