我试过这样: 这里肥皂请求标题正确显示。但当我尝试肥皂响应headres没有替换我收到此错误: com.ctc.wstx.exc.WstxIOException:尝试读取已关闭的流。 请帮帮我任何一个 谢谢你。
class ap{
public static void main(String[] args) throws RemoteException {
TestStub stub = new TestStub();
AddTwoNumbers re=new AddTwoNumbers();
re.setFirstNumber(1);
re.setSecondNumber(5);
AddTwoNumbersResponse res=stub.addTwoNumbers(re);
System.out.println(res.get_return());
try{
OperationContext operationContext = stub._getServiceClient().getLastOperationContext();
operationContext.cleanup();
if (operationContext != null) {
MessageContext outMessageContext = operationContext.getMessageContext("Out");
if (outMessageContext != null) {
System.out.println("OUT SOAP: "+outMessageContext.getEnvelope().toString());
}
stub.cleanup();
MessageContext inMessageContext = operationContext.getMessageContext("In");
if (inMessageContext != null) {
System.out.println("IN SOAP: "+ inMessageContext.getEnvelope().toString());
//inMessageContext.build();
}
}
} catch(Throwable e) {
System.out.println("Cannot log soap messages: "+e.getMessage());
}