I try to do something really simple in theory : deserialize a string to a Message, here is the code :
[TestMethod]
public void EncoderErrorTest()
{
var message = "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\"http://www.w3.org/2005/08/addressing\"><s:Header><a:Action s:mustUnderstand=\"1\">http://tempuri.org/IHelloWorldService/SayHello</a:Action></s:Header><s:Body><SayHello xmlns=\"http://tempuri.org/\"><name>Nico</name></SayHello></s:Body></s:Envelope>";
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(message);
stream.Position = 0;
var soapMessage = new TextMessageEncodingBindingElement().CreateMessageEncoderFactory().Encoder.ReadMessage(stream, 99999);
Assert.IsNotNull(soapMessage);
}
But during the deserialization I get a XmlException "Unexpected end of file". Is something wrong with my code ?
Thanks in advance for your responses.