c# - WCF SOAP XML parent tag remove -
i having problem, have remove encloseing tag, operation contract :
public list<messagestatus> sendmessages(list<messageto> messages)
and xml formed after adding in soapui output given below:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sms="https://sms.responsetek.com/"> <soapenv:header/> <soapenv:body> <sms:sendmessages> <!--optional:--> <sms:messages> <!--zero or more repetitions:--> <message> <mid>?</mid> <oa>?</oa> <da>?</da> <text>?</text> <!--optional:--> <exp>?</exp> </message> </sms:messages> </sms:sendmessages> </soapenv:body> </soapenv:envelope>
i want remove <sms:messages>
tag it.
try following :
using system; using system.collections.generic; using system.linq; using system.text; using system.xml; using system.xml.linq; namespace consoleapplication69 { class program { const string filename = @"c:\temp\test.xml"; static void main(string[] args) { xdocument doc = xdocument.load(filename); xelement messages = doc.descendants().where(x => x.name.localname == "messages").firstordefault(); messages.remove(); } } }
Comments
Post a Comment