我尝试使用Apache CXF 2.7.18实现WS-Addressing。我可以设置一些像To,Action等标题..但我想从SOAP请求中删除/删除ReplyTo
<Action xmlns="http://www.w3.org/2005/08/addressing">http://...</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:....</MessageID>
<To xmlns="http://www.w3.org/2005/08/addressing">https://....</To>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
有人知道怎么做吗?
答案 0 :(得分:1)
即使有点脏,我也找到了解决方案,但对我有用。我已将其显式设置为“ null”(使用Cxf和JaxWsProxyFactoryBean)。
EndpointReferenceType replyTo = new EndpointReferenceType();
AddressingProperties addrProperties = new AddressingProperties();
AttributedURIType replyToURI = new AttributedURIType();
EndpointReferenceType from = new EndpointReferenceType();
AttributedURIType fromURI = new AttributedURIType();
fromURI.setValue("ms-register");
from.setAddress(fromURI);
addrProperties.setFrom(from);
addrProperties.setFrom(from);
replyToURI.setValue(null);
replyTo.setAddress(replyToURI);
addrProperties.setReplyTo(replyTo);
client.getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES,addrPropertie);