2
我有以下的ServiceContract:根据需要WCF服务操作的马克参数
[ServiceContract(Namespace = Constants.NAMESPACE)]
public interface IAuthenticationService
{
[OperationContract]
LoginResult Login(LoginData data);
}
[DataContract(Namespace = Constants.NAMESPACE)]
public class LoginData
{
[DataMember(IsRequired = true, Order = 1)]
public string SupplierName { get; set; }
[DataMember(IsRequired = true, Order = 2)]
public string Token { get; set; }
}
当我创建肥皂UI一个新的请求的请求表明这一点:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://namepsace.org/">
<soapenv:Header/>
<soapenv:Body>
<ws:Login>
<!--Optional:-->
<ws:data>
<ws:SupplierName>?</ws:SupplierName>
<ws:Token>?</ws:Token>
</ws:data>
</ws:Login>
</soapenv:Body>
</soapenv:Envelope>
我找不到理由为什么<!--Optional:-->
在数据元素之上。
上面的代码做了完全一样的答案How to specify a parameter of an OperationContract as required
建议什么我需要做的,使所需的数据参数?
你的意思是'< - 可选:! - >'?或''''?我没有看到''''。 – 2013-03-05 11:53:30
谢谢您指出。我已经编辑了我的问题。 – amaters 2013-03-05 12:53:27
[WCF:是否有一个属性可以使OperationContract中的参数成为必需?](https://stackoverflow.com/questions/12836534/wcf-is-there-an-attribute-to-make-parameters-in -the-operationcontract-required) – Deantwo 2017-10-24 07:45:26