一、场景说明:
对接海康8200,接受海康卡口车辆数据,webService方式交互数据,海康为客户端使用协议soap1.2,我们服务端使用jax-ws进行的发布,默认使用的协议soap1.1。soap1.2客户端无法访问soap1.1的服务端。此时客户端进行请求,服务器端会报状态码415——后台程序不支持提交的content-type(协议不匹配 ),经过协调,我们服务端用soap1.2替换soap1.1,且发布的wsdl文件应符合海康给出的wsdl规范。
二、代码:
- interface接口:IHikThirdBayonetService
import javax.jws.WebService; @WebService public interface IHikThirdBayonetService { public String initSystem( String xml); public String insertVehicleInfo ( String xml); }
- interface接口实现:HikThirdBayonetService(命名空间值根据实际需求定)
import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; @WebService public class HikThirdBayonetService implements IHikThirdBayonetService{ @WebMethod(action = "urn:initSystem") @RequestWrapper(localName = "initSystem", targetNamespace = "http://service.thirdBayonet.webservice.bms.hikvision.com") @ResponseWrapper(localName = "initSystemResponse", targetNamespace = "http://service.thirdBayonet.webservice.bms.hikvision.com") @WebResult(name &