.net - Getting Gibberish instead of Hello World from a service with webHttpBinding -


Here is a trivial example that is considered to be "Hello World" string back. However, a browser displays something like SGVsbG8gV29ybGQ = .

Please know that:

  1. I can not return a string: three Unicode characters will be automatically generated and the legacy HTTP client is not able to interoperate Will happen.

  2. I can return a message , but still keep parsing the data variable to remove the same functionality AFAIK is not allowed in the message and int type in the signature

     [communication of service (session-mode = session mode. Narayan)] Public Interface IHello {[WebGet (UriTemplate = "manager? Data = {data}")] [operationcontract] byte [] DoIt (int data); }  

    Public class Hello: IHello {Public byte [] DoIt (int data) {return encoding. ASCII.GetBytes ("HelloWald"); }}

    UPDATE : This is not ambiguous, but correctly the encoded response is. However, the format is not expected to get me. I have thought (gentlemen as the suggestion below) that the last control of the transport layer message format is obtained with the message class. However, if I use one - I lose the possibility of parsing the request ( UriTemplate attribute). Therefore, it would be good to know about integrating UriRequest with "code"> message .

    PS If "clean" integration is not possible - what is the most elegant solution? Is there a code behind the curtain of the wire which I can borrow and use in my implementation, please?

itemprop = "text">

It is not weak - this is the 64-encoded version of ASCII bytes for "Hello World" (with space) .

When you ask a web service to transmit the bytes, it will use base 64.

(I use the encoding.assici Remember, remember me.)

/ P>

It is not clear what your "legacy HTTP client" is, or what's its Hopefully, so we can not really tell that returning a byte array is actually the best answer or not.


Comments