I have a WCF service hosted over HTTP. The service has an opertation as the following:
[OperationContract]
MyResponse ProcessRequest(MyRequest request);
and the message contracts:
[MessageContract]
public class MyRequest
{
[MessageBodyMember(Namespace = "http://company.com/schema/myobjectschema/2", Name = "RequestPayLoad")]
public RequestPayLoadType RequestPayLoad{ get; set; }
}
The RequestPayLoadType object is generated out of the schema file using xsd.exe and has all the appropriate namespaces.
Now when I invoke this service operation from SOAP UI, I'm finding that the soap UI request for ProcessRequest operation has all private fields in RequestPayLoadType present in the request. This is actually not accordance with the schema and the java client which is consuming this is breaking because of this.
For example my requestpayloadtype is structured as follows:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://company.com/schema/myobjectschema/2")]
[System.Xml.Serialization.XmlRootAttribute("EventHeader", Namespace = "http://company.com/schema/myobjectschema/2",
IsNullable = false)]
public class RequestPayLoadType
{
private string messageIDField;
public string MessageID
{
get
{
return this.messageIDField;
}
set
{
this.messageIDField = value;
}
}
}
When I send a request to the service the request is forming like this:
<ns:TimeSeriesPayload>
<messageIDField >?</messageIDField >
</ns:TimeSeriesPayload>
My question is: why is the private field apperaing in the request. Why not the public properties. Is there an attribute which I set for preventing this from happening? My schema has deep level nesting so can I use an attrbute on the root level to prevent this from happening?