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