Remove xml namespaces from WCF restful response

前端 未结 9 1668
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-05 11:13

I am using WCF to return a plain old XML (POX) document to the caller. I am using the XML Serializer formatter to turn the objects into XML.

In the returned docum

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 11:38

    I have the same problem when I work with ASMX clients and For me this solve the problem :

    Add to your Service Interface :

    [XmlSerializerFormat(Use = OperationFormatUse.Literal, Style = OperationFormatStyle.Document)]
    

    Add to Operations :

    [OperationContract(Action = "http://www.YourNameSpace.com/ActionName",ReplyAction = "http://www.YourNameSpace.com/ActionName")]
    

提交回复
热议问题