【发布时间】:2010-10-09 03:59:25
【问题描述】:
我正在编写一个简单的 Web 方法,它返回 byte[],而 byte[] 由 UTF-8 编码。调查了相关的WSDL和soap消息,好像底层的web服务栈会使用base64编码?
由于各种原因,我无法使用或将返回的字节 [] 从 UTF-8 重新编码为 base64。有什么想法可以将 base64 编码修改为 UTF-8 编码?
这是我在 WSDL 中的相关 Web 方法、SOAP 消息和相关类型
Web服务服务器端代码
[WebMethod]
public byte[] HelloWorld2()
{
return utf8encodedbytes;
}
SOAP 响应
<?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>
WSDL 中的相关类型
xsd:base64Binary
提前致谢, 乔治
【问题讨论】: