Когда вы используете Axis для генерации прокси для службы WCF, он генерирует заглушку, которая автоматически устанавливает заголовок MustUnderstand
для http://www.w3.org/2005/08/addressing
Приведенный ниже код сбрасывает флаг MustUnderstand обратно в false.для вызываемого метода.У меня была похожая проблема сегодня, и я смог ее решить, используя код, который выложен здесь
//maybe someother service stub,i show you a case
CommentWcfServiceLocator locator =new CommentWcfServiceLocator();
WSHttpBinding_ICommentServiceStub stub;
try {
//get a stub and set service url
stub = (WSHttpBinding_ICommentServiceStub) locator.getWSHttpBinding_ICommentService(new java.net.URL("http://www.google.com/CommentWcfService.svc"));
// the key is here , importantest!!! follow this
// set action, action path,you can find in your java code
SOAPHeaderElement action = new SOAPHeaderElement(new QName("wsa:Action"), "http://tempuri.org/ICommentService/GetCommentSummaryByHotelId");
SOAPHeaderElement to = new SOAPHeaderElement(new QName("wsa:To"),
stub._getProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY));
action.setActor(null);
action.setNamespaceURI("http://www.w3.org/2005/08/addressing");
to.setActor(null);
to.setNamespaceURI("http://www.w3.org/2005/08/addressing");
// set header
stub.setHeader(action);
stub.setHeader(to);
// must set this property
stub._setProperty(Call.CHECK_MUST_UNDERSTAND, Boolean.FALSE);
stub.getCommentSummaryByHotelId("","02201158", 0);
}
catch(Exception EX){}
Я нашел этот пост в MustUnderstand veru полезным.