Hi,

I am developing a REST WCF Web Service using the webHttpBinding. This service is supposed to receive a parameter through HTTP POST and return a byte array (byte[]). However whenever I call the service I get the following respose:

<base64Binary xmlns="http://schemas.microsoft.com/2003/10/Serialization/">AQEBAAEAFFBBAPQ=</base64Binary>

Is there a way to configure my service so that it will return only the byte array without the XML tags and without being encoded on base 64? For example it should return something like 6232991110 instead of the content above.

Thanks,
Komyg

Hi,

I finally did it! Apparently my Operation contract was wrong, I was using a string in as the input and output value of my method, however I discovered that all I needed was a Stream.

Here is the wrong code:

[OperationContract]
        [WebInvoke(
            UriTemplate = "/WCF_PostTest",
            BodyStyle = WebMessageBodyStyle.Bare
        )]
        string WS_PostTest(string request);

And here is the correct code:

[OperationContract]
        [WebInvoke(
            UriTemplate = "/WCF_PostTest",
            BodyStyle = WebMessageBodyStyle.Bare
        )]
        Stream WCF_PostTest(Stream request);

Thanks,
Komyg

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.