简体   繁体   中英

WCF structure soap message

i have a problem. How can I realize a similar structure in WCF?

<MessageData>
   <AppData>
     <Name>Eugene</Name>
     <SureName>Tolpygo</SureName>
   </AppData>
</MessageData>

i tried to use [DataContract] and [DataMember] but it's not work.

[UPDATE 1] I need to do soap web service.

My Code

 public MessageDataType Get() { MessageDataType MessageData = new MessageDataType(); return MessageData; } [DataContract] public class MessageDataType { [DataMember] AppDataType AppData = new AppDataType(); } [DataContract] public class AppDataType { [DataMember] string Name = "Eugene"; [DataMember] string Surname = "Tolpygo"; } 

I didn't get it very well, but try to use ResponseFormat = WebMessageFormat.Xml in attribute WebGet()

[WebGet(ResponseFormat = WebMessageFormat.Xml]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM