2

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?

Deantwo
  • 1,113
  • 11
  • 18
amaters
  • 2,266
  • 2
  • 24
  • 44
  • 2
    You mean ``? Or `''`? I don't see a `''`. – Grant Thomas Mar 05 '13 at 11:53
  • Possible duplicate of [WCF: is there an attribute to make parameters in the OperationContract required?](https://stackoverflow.com/questions/12836534/wcf-is-there-an-attribute-to-make-parameters-in-the-operationcontract-required) – Deantwo Oct 24 '17 at 07:45

1 Answers1

-1

Here is what you can use, i came across this one while searching answer to this question

Community
  • 1
  • 1
bhupendra patel
  • 3,139
  • 1
  • 25
  • 29