XML Response contains HTML encoding on API Response?

The implementation you have doesn't compile - the method is declared to return a Stream but it's returning a String If you return as a string, it will encode the XML characters; if you don't want the encoding, return it either as a Stream or as a XmlElement (or XElement) Update with example This is an example of a method returning a Stream for an arbitrary XML response: WebGet public Stream GetXML() { string theXml = @" 2 150 2 8 120 5 "; WebOperationContext.Current. OutgoingResponse. ContentType = "text/xml"; MemoryStream result = new MemoryStream(Encoding.

UTF8. GetBytes(theXml); return result; }.

The implementation you have doesn't compile - the method is declared to return a Stream, but it's returning a String. If you return as a string, it will encode the XML characters; if you don't want the encoding, return it either as a Stream or as a XmlElement (or XElement). Update with example This is an example of a method returning a Stream for an arbitrary XML response: WebGet public Stream GetXML() { string theXml = @" 2 150 2 8 120 5 "; WebOperationContext.Current.

OutgoingResponse. ContentType = "text/xml"; MemoryStream result = new MemoryStream(Encoding. UTF8.

GetBytes(theXml); return result; }.

This is where I'm stuck. I've scoured the internet for a working example but have found nothing. Using string was the only way I could get the XML to send back.

When attempting to send it back as a Stream nothing is received on the client side. – Nozoku Jul 15 at 18:25 I added an example in the answer – carlosfigueira Jul 15 at 20:38 Got it working. Thanks man.

– Nozoku Jul 18 at 19:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions