c# - .Net Rest Web Service response has default Data Contract namespace rather than expected namespace -


details:

interface contract:

[operationcontract] [webget(uritemplate = "test")] testtype testoperation(); 

type definition:

[system.xml.serialization.xmlroot(elementname = "test", namespace="http://test.net/", isnullable=false)] public partial class testtype { 

actual result:

<testtype xmlns=http://schemas.datacontract.org/2004/07/ … 

expected result:

<test xmlns= http://test.net/ … 

please advise ??

the service using datacontractserilizer serialize response , therefore requires data contract namespace. in order override recommend applying xmlserialzeformat attribute operation follows...

[operationcontract] [webget(uritemplate = "test")] [xmlserializerformat] testtype testoperation(); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -