3

我试过这样:这里soap请求标头显示正确。但是当我尝试soap响应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());
}
4

0 回答 0