Not possible specify a namespace for the nested type in the MessageContract. RRS feed

  • Question

  • Good afternoon.

    Faced with a vexing problem that can not be solved for several days. 

    I need to design a server, given certain requirements. Soap must look a certain way. This is requirement...

    Here is the message that I am able to generate:

    <a:ANotherBool>, <a:AnotherStringValue> - is not correct. Namespace must be  "http_://"

    <s:Envelope xmlns:s="">
    <BoolValue xmlns="">true</BoolValue>
    <StringValue xmlns="">HelloWorld</StringValue>
    <InnerType xmlns="" xmlns:a="" xmlns:i="">

    Here is the code that I use.

    [ServiceContract(Namespace = "")]
    public interface IService1
        CompositeType GetDataUsingDataContract(CompositeType composite);
    [MessageContract(WrapperNamespace = "", IsWrapped = false)]
    public class CompositeType
        [MessageBodyMember(Namespace = "")]
        public bool BoolValue;
        [MessageBodyMember(Namespace = "")]
        public string StringValue;
        [MessageBodyMember(Namespace = "")]
        public InnerType InnerType;
    [MessageContract(WrapperNamespace = "", IsWrapped = false)]
    public class InnerType
        [MessageBodyMember(Namespace = "")]
        public bool ANotherBool;
        [MessageBodyMember(Namespace = "")]
        public string AnotherStringValue;
    // impl
    [ServiceBehavior(Namespace = "")]
    public class Service1 : IService1
        public CompositeType GetDataUsingDataContract(CompositeType composite)

    I believe that MessageContract - this is the easiest way to create a desired message type.
    However, if the problem is still not able to resolve - can anyone suggest an alternative solution?

    Wednesday, February 18, 2015 9:57 AM

All replies