I have the following ServiceContract:
[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; }
}
When I create a new Request with Soap UI the Request shows this:
<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>
I cannot find the reason why <!--Optional:-->
is above the data element.
The above code did exactly as an answer suggested in How to specify a parameter of an OperationContract as required
What do I need to do to make the data parameter required?