George George

George George

  • NA
  • 778
  • 0

base64 and UTF-8 encoding issue

Feb 22 2009 9:11 AM

Hello everyone,


I am writing a simple web method which returns byte[], and the byte[] is encoded by UTF-8. I have investigated related WSDL and soap message, seems the underlying web services stack will use base64 encoding?

For various reasons, I can not use or re-encode my return byte[] from UTF-8 to base64. Any ideas to modify the base64 encoding to UTF-8 encoding?

Here is my related web methods, SOAP message and related type in WSDL

[Code]
Web service server side code

        [WebMethod]
        public byte[] HelloWorld2()
        {
            return utf8encodedbytes;
        }

SOAP response

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <HelloWorld2Response xmlns="http://tempuri.org/">
      <HelloWorld2Result>base64Binary</HelloWorld2Result>
    </HelloWorld2Response>
  </soap:Body>
</soap:Envelope>

related type in WSDL

xsd:base64Binary
[/Code]

thanks in advance,
George


Answers (1)