0

我建立

public class ExceptionHandler implements SOAPHandler<SOAPMessageContext>

我想用非 ascii 字符创建肥皂标题。

MessageFactory factory = MessageFactory.newInstance();
SOAPMessage soapMsg = factory.createMessage();
//soapMsg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "utf-8");
SOAPHeaderElement aaa = soapMsg.getSOAPHeader().addHeaderElement(new QName("test", "aaa"));
aaa.addTextNode("ść");
context.setMessage(soapMsg);

我得到的回应是:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header>
       <aaa xmlns="test">ść&lt;/aaa>
   </env:Header>
   <env:Body/>
</env:Envelope>

这个 api 不支持 nonascii 字符还是一个错误?

4

0 回答 0