I have following message contract:
[MessageContract(IsWrapped = false)]
public class fooResponse
{
[MessageBodyMember(Namespace = "http://www.demo.com/serviceSchemaTypes-v1.4/")]
public commonReturnType fooResponse1 { get; set; }
}
And the commonReturnType
is a DataContract
below:
[DataContract(Namespace = "http://www.demo.com/serviceSchema-v1.4/")]
public class commonReturnType
{
[DataMember]
public returnCode returnCode { get; set; }
[DataMember]
public string errorMessage { get; set; }
}
Generated WSDL file overrides namespace of commonReturnType
to namespace of public commonReturnType fooResponse1 { get; set; }
public commonReturnType fooResponse1 { get; set; }
public commonReturnType fooResponse1 { get; set; }
. After importing the generated WSDL file into another project, commonReturnType
looks like this:
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.demo.com/serviceSchemaTypes-v1.4/")]
public partial class commonReturnType
Here, namespace should be http://www.demo.com/serviceSchema-v1.4/
. Why the namespace is changing here and how can I fix this issue?
The reason for your error is probably that you set this property:
IsWrapped = false
You can refer to the official documentation: Using Message Contracts to make changes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.