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;
}