java SOAP中文乱码!!!!
我创建soap信息的方式如下:
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope requestEnvelope = soapPart.getEnvelope();
SOAPBody body = requestEnvelope.getBody();
SOAPBodyElement tt = body.addBodyElement(requestEnvelope.createName("MTReq"));
SOAPElement subject = tt.addChildElement("Subject");
subject.addTextNode("中文人");
然后我把该soap消息输出到控制台(输出的方式是:soapMessage.writeTo(System.out);),得到的结果是:
------=_Part_0_25292190.1264686044609
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <5A40EDD971F1137EA00571F53DC56662>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
<MTReq>
<Subject>中文人</Subject>
</MTReq>
</soapenv:Body>
</soapenv:Envelope>
为什么“中国人”的汉字变成了红色部分的乱码呀??
请问大家有什么办法解决这样的乱码吗?????
有什么样的办法改变上面mime头(Content-Type: text/xml; charset=UTF-8)的编码方式为“GB2312”吗??
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope requestEnvelope = soapPart.getEnvelope();
SOAPBody body = requestEnvelope.getBody();
SOAPBodyElement tt = body.addBodyElement(requestEnvelope.createName("MTReq"));
SOAPElement subject = tt.addChildElement("Subject");
subject.addTextNode("中文人");
然后我把该soap消息输出到控制台(输出的方式是:soapMessage.writeTo(System.out);),得到的结果是:
------=_Part_0_25292190.1264686044609
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <5A40EDD971F1137EA00571F53DC56662>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
<MTReq>
<Subject>中文人</Subject>
</MTReq>
</soapenv:Body>
</soapenv:Envelope>
为什么“中国人”的汉字变成了红色部分的乱码呀??
请问大家有什么办法解决这样的乱码吗?????
有什么样的办法改变上面mime头(Content-Type: text/xml; charset=UTF-8)的编码方式为“GB2312”吗??
...全文
相关推荐
java发送SOAP报文
NULL 博文链接:https://softwarexiang120.iteye.com/blog/2065082
jmeter中WebService插件(解决中文乱码)
jmeter中WebService插件(解决中文乱码)
android上的soap裁剪包
android上的soap裁剪包,另外可以参见我的csdn上的文章;
WEBSPHERE乱码问题的解决和处理
WEBSPHERE乱码问题的解决和处理。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
java 数据库内容乱码解决方法
java 数据库内容乱码解决方法 java 数据库内容乱码解决方法


