Lord Vermillion Lord Vermillion - 1 year ago 164
C# Question

WCF required parameters in wsdl

Assume i have a method in my WCF Service:

ResponseObj Test(string testString);

When i add this WSDL to soapUI the testString will be marked as optinal


How do i make the testString parameter required?
Do i need to add something in the OperationContract method? Or are all parameters Optional in the request in soapUI?

Answer Source

use data contract with IsRequired attribute for the properties

ResponseObj Test(RequestMessage request);

public class RequestMessage
   [DataMember(IsRequired = true)]
   public string TestString{ get; set; }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download