Httpurlconnection远程调用webservice

问题:

c.sun.xml.internal.messaging.saaj.soap.SOAPVersionMismatchException: Cannot cr
te message: incorrect content-type for SOAP version. Got: application/soap+xml
charset=utf-8; action="" Expected: text/xml

解决:设置soap协议为1.2即可

在springboot中添加一下代码

//soap1.2
@Bean
public SaajSoapMessageFactory messageFactory() {
SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
messageFactory.setSoapVersion(SoapVersion.SOAP_12);
return messageFactory;
}

posted @ 2017-12-23 13:44  wupf  阅读(1091)  评论(0编辑  收藏  举报