Return without xml root

2019-08-16 13:02发布

I'm facing some issue, I guess because I'm not very familiar with all the framework its pretty hard for me.

when i built my old rest its was in httphandler, now i got it in WCF rest the old rest returned XML stream as it is with the header of <xml ....> the new service return only XML like SOAP.

I need to transform this XML with XSL so I did it like that:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(xml);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());

//Transform the xml to stream
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(reader.ReadToEnd()));
XPathDocument document = new XPathDocument(stream);

StringWriter writer = new StringWriter();

XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(xsltURL);
transform.Transform(document, null, writer);

How should I do it now? or maybe how to force the soap to return the header of whats better way to do it, i also want that the new serice could use in other systems.

标签: c# rest soap
0条回答
登录 后发表回答