Java SpringWeb服务模板集MustUnderstand设置为none或false
如何将MustUnderstand设置为none或false。我正在使用SpringBoot和web服务模板创建客户端 POM.xmlJava SpringWeb服务模板集MustUnderstand设置为none或false,java,soap,spring-boot,soap-client,spring-ws,Java,Soap,Spring Boot,Soap Client,Spring Ws,如何将MustUnderstand设置为none或false。我正在使用SpringBoot和web服务模板创建客户端 POM.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-ws</artifactId> </dependency> BrokerConnectionSe
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
BrokerConnectionServiceClient.java
public class BrokerConnectionServiceClient extends WebServiceGatewaySupport {
private static final Logger log = LoggerFactory.getLogger(BrokerConnectionServiceClient.class);
@Autowired
private LuiUrlBuilder luiUrlBuilder;
public void getBrokerConnectionServiceData(ConnectionRequestType connectionRequestType) {
log.debug("inside getBrokerConnectionServiceData");
try {
getWebServiceTemplate()
.marshalSendAndReceive(
new JAXBElement<>(new QName(Constants.BROKER_CONNECTION_SERVICE_NAMESPACE_URI, Constants.BROKER_CONNECTION_SERVICE_LOCAL_PART), ConnectionRequestType.class, connectionRequestType),
new ActionCallback(new URI(luiUrlBuilder.getConnectionServiceCallBackLocation()), new Addressing200408()));
} catch (URISyntaxException e) {
log.trace("URISyntaxException occurred", e);
}
}
}
getWebServiceTemplate()
.marshalSendAndReceive(
new JAXBElement<>(new QName(Constants.BROKER_CONNECTION_SERVICE_NAMESPACE_URI, Constants.BROKER_CONNECTION_SERVICE_LOCAL_PART), ConnectionRequestType.class, connectionRequestType),
new WebServiceMessageCallback() {
@Override
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
SOAPMessage soapMessage = ((SaajSoapMessage) message).getSaajMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
SOAPHeaderElement actionElement = soapHeader.addHeaderElement(new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "Action", "wsa"));
actionElement.setMustUnderstand(false);
actionElement.setTextContent("ConnectionService");
}
});
公共类BrokerConnectionServiceClient扩展了WebServiceGatewaySupport{
私有静态最终记录器日志=LoggerFactory.getLogger(BrokerConnectionServiceClient.class);
@自动连线
私人LuiUrlBuilder LuiUrlBuilder;
public void getBrokerConnectionServiceData(ConnectionRequestType ConnectionRequestType){
调试(“在getBrokerConnectionServiceData内部”);
试一试{
getWebServiceTemplate()
马歇尔先生(
新的JAXBElement(新的QName(Constants.BROKER\u CONNECTION\u SERVICE\u NAMESPACE\u URI、Constants.BROKER\u CONNECTION\u SERVICE\u LOCAL\u PART)、ConnectionRequestType.class、ConnectionRequestType),
新的ActionCallback(新的URI(luiUrlBuilder.getConnectionServiceCallBackLocation()),新的Addressing200408());
}捕获(URISyntaxException e){
trace(“发生了URISyntaxException”,e);
}
}
}
请告诉我如何将“必须理解”设置为“无”或“假”,并将“WS-A版本”设置为“200508”而不是“200408”
提前感谢使用我们可以实现的WebServiceMessageCallback。ActionCallback实习生实现WebServiceMessageCallback
BrokerConnectionServiceClient.java
public class BrokerConnectionServiceClient extends WebServiceGatewaySupport {
private static final Logger log = LoggerFactory.getLogger(BrokerConnectionServiceClient.class);
@Autowired
private LuiUrlBuilder luiUrlBuilder;
public void getBrokerConnectionServiceData(ConnectionRequestType connectionRequestType) {
log.debug("inside getBrokerConnectionServiceData");
try {
getWebServiceTemplate()
.marshalSendAndReceive(
new JAXBElement<>(new QName(Constants.BROKER_CONNECTION_SERVICE_NAMESPACE_URI, Constants.BROKER_CONNECTION_SERVICE_LOCAL_PART), ConnectionRequestType.class, connectionRequestType),
new ActionCallback(new URI(luiUrlBuilder.getConnectionServiceCallBackLocation()), new Addressing200408()));
} catch (URISyntaxException e) {
log.trace("URISyntaxException occurred", e);
}
}
}
getWebServiceTemplate()
.marshalSendAndReceive(
new JAXBElement<>(new QName(Constants.BROKER_CONNECTION_SERVICE_NAMESPACE_URI, Constants.BROKER_CONNECTION_SERVICE_LOCAL_PART), ConnectionRequestType.class, connectionRequestType),
new WebServiceMessageCallback() {
@Override
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
SOAPMessage soapMessage = ((SaajSoapMessage) message).getSaajMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
SOAPHeaderElement actionElement = soapHeader.addHeaderElement(new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "Action", "wsa"));
actionElement.setMustUnderstand(false);
actionElement.setTextContent("ConnectionService");
}
});
getWebServiceTemplate()
马歇尔先生(
新的JAXBElement(新的QName(Constants.BROKER\u CONNECTION\u SERVICE\u NAMESPACE\u URI、Constants.BROKER\u CONNECTION\u SERVICE\u LOCAL\u PART)、ConnectionRequestType.class、ConnectionRequestType),
新的WebServiceMessageCallback(){
@凌驾
public void doWithMessage(WebServiceMessage消息)引发IOException、TransformerException{
SOAPMessage SOAPMessage=((SaajSoapMessage)消息);
SOAPHeader SOAPHeader=soapMessage.getSOAPHeader();
SOAPHeaderElement actionElement=soapHeader.addHeaderElement(新QName(“http://schemas.xmlsoap.org/ws/2004/08/addressing“、”行动“、”wsa”);
actionElement.setMustUnderstand(false);
actionElement.setTextContent(“ConnectionService”);
}
});
输出
<wsa:Action soapenv:mustUnderstand="0">ConnectionService</wsa:Action>
ConnectionService
其余字段也一样