Java 使用SOAPMessage.writeTo强制打印SOAPHeader内容

Java 使用SOAPMessage.writeTo强制打印SOAPHeader内容,java,soap,jax-ws,wsimport,Java,Soap,Jax Ws,Wsimport,我对观察到的SOAPMessage的行为感到有点困惑,写在- 我构建了一个SOAPHandler,以确保所有传出的SOAP消息都设置了一些特定的SOAP头。我有以下代码获取将要发送的输出: ByteArrayOutputStream out = new ByteArrayOutputStream(); message.writeTo(out); String strMsg = new String(out.toByteArray()); 如果将上述内容通过管道传输到stdout,我会看到如下消

我对观察到的SOAPMessage的行为感到有点困惑,写在-

我构建了一个SOAPHandler,以确保所有传出的SOAP消息都设置了一些特定的SOAP头。我有以下代码获取将要发送的输出:

ByteArrayOutputStream out = new ByteArrayOutputStream();
message.writeTo(out);
String strMsg = new String(out.toByteArray());
如果将上述内容通过管道传输到stdout,我会看到如下消息:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><S:Body xmlns:ns2="http://blah.com/blah" xmlns:ns3="http://foo.com/foo"><ns2:myStuff>...</ns2:myStuff></S:Body></S:Envelope>
其中打印:

com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl@d2a3aad
1
[my:Id: null]
111111

通过阅读文档,我知道MIME标题不会被打印出来,但我认为SOAPHeaders不会有问题?

你找到解决方案了吗?@4535992不幸的是,我们没有找到解决方案?@4535992不幸的是,我们没有找到解决方案
com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl@d2a3aad
1
[my:Id: null]
111111