[quoted text, click to view] "Dragan" <Dragan@discussions.microsoft.com> wrote in message
news:D060E9E0-03F7-464F-AB44-4C3B5DD21760@microsoft.com...
>
>> An even better way to (maybe) reproduce the problem would be:
>>
>> [WebMethod]
>> public string ValidateAmount(string amount)
>> {
>> return "\r\n";
>> }
>>
>> Then, in your client:
>>
>> Service1 NewLineService = new Service1();
>> string result = NewLineService.ValidateAmount(null);
>> Trace.WriteLine(result.Length.ToString());
>> for (int i=0; i<result.Length; i++)
>> {
>> Trace.WriteLine(String.Format("Char {0}={1:X}", i,
>> Convert.ToUInt16(result[i])));
>> }
>>
>> Try that and see what the result is.
>> --
>> --------------------------------------------------------------------------------
>> John Saunders | MVP - Windows Server System - Connected System Developer
>>
>>
>>
>
> I have executed your sample code and the output was:
> 1
> Char 0=A
>
> But when I copy the ValidateAmount method to the client application (not
> in
> a web service), everything is working properly and the output is:
> 2
> Char 0=D
> Char 1=A
>
Excellent. You have now shown that there _is_ a problem, and you're close to
finding out exactly _what_ the problem is. It's always better to narrow
things down to the smallest example that demonstrates the problem.
Note: there are parts of XML that use the concepts of significant whitespace
and insignificant whitespace. To narrow this down just a little further, try
the same experiment with " \r\n ". I'm betting you'll get 20 20 20 0A 20
20 20. That is, I want to see if the problem is specific to newline handling
or whether it is an issue with whitespace in general.
I suspect that you may need to serialize your string as base64Binary or
hexBinary if you want it preserved exactly.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer