namespace prefix not being appended by WCF proxy while sending request to svc service RRS feed

  • Question

  • Hey Guys,

    We are consuming svc services being offered by one of the API providers as such. We created proxy of svc using svcutil (as c sharp class). There is one property that is defined as below in the proxy class:

    [System.Xml.Serialization.XmlArrayItemAttribute(Namespace = "")]
    public string[] PClasses
                    return this.pClassesField;
                    this.pClassesField = value;

    Now the server is expecting the xml as below:


    However when we try to intercept the request using fiddler the request xml being sent by our proxy is like below:

            <string xmlns=\"\">ABC</string>
            <string xmlns=\"\">DEF</string>

    The svc service finds the above xml incorrect and ignores it resulting in wrong response. 

    Can anyone point out how we can add <arr: prefix to this list (array of string)? Or is there anything that we are missing while generating the proxy class itself.

    Your help shall be greatly appreciated.



    Best Regards

    Wednesday, November 6, 2019 2:52 PM

All replies

  • Hi,

    The serialization structure is not precisely controlled by the WCF default serializer, so we can only add namespaces. 

    public class Product
            public int ID { get; set; }
            public string Name { get; set; }        
            [XmlArray(Namespace ="ArrayNameSpace")]
            [XmlArrayItem(Namespace ="ItemNamespace")]
            public string[] Description

    As far as I know, for communicating with the java server, the prefix in serialization does not matter.
    If you serialize manually, you can refer to the following example to add a prefix.

    Welcome to share your solution with me, thank you.
    Feel free to let me know if there is anything I can help with.
    Best Regards

    Thursday, November 7, 2019 6:51 AM