Kotlin 向驼峰端点发送消息时的SOAP版本mistmach
我用camel和cxf创建了webservice。 我的bean设置:Kotlin 向驼峰端点发送消息时的SOAP版本mistmach,kotlin,soap,apache-camel,cxf,Kotlin,Soap,Apache Camel,Cxf,我用camel和cxf创建了webservice。 我的bean设置: @Bean open fun cxfServlet(): ServletRegistrationBean<CXFServlet> { val servlet = ServletRegistrationBean(CXFServlet(), "/ws/*") servlet.setLoadOnStartup(1) servlet.setName("cxfServlet") return
@Bean
open fun cxfServlet(): ServletRegistrationBean<CXFServlet> {
val servlet = ServletRegistrationBean(CXFServlet(), "/ws/*")
servlet.setLoadOnStartup(1)
servlet.setName("cxfServlet")
return servlet
}
@Bean
open fun cxf(): Bus {
return BusFactory.newInstance().createBus()
}
@Bean("etp")
open fun cxfEndpoint(): CxfEndpoint {
val endpoint = CxfEndpoint()
endpoint.beanId = "etp"
endpoint.address = "/etp"
endpoint.serviceClass = Product::class.java
endpoint.wsdlURL = "wsdl/example.wsdl"
endpoint.dataFormat = DataFormat.POJO
endpoint.bindingId = SOAPBinding.SOAP12HTTP_BINDING
return endpoint
}
但是当我从soapUI发送消息时,我得到一个错误:
org.apache.cxf.binding.soap.SoapFault:soap 1.2消息发送到仅限soap 1.1的端点时无效
但如果我将dataFormat值设置为“RAW”:
错误消失了。
有什么问题吗
我找到了soap绑定的xml设置:
<cxf:binding>
<soap:soapBinding version="1.2"/>
</cxf:binding>
但是我应该在哪里设置它呢?问题出在WSDL文件中。它有一个名称空间: xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap/" 但此命名空间适用于soap版本1.1。
要使用soap 1.2版本创建服务,应设置命名空间: xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap12/"
endpoint.dataFormat = DataFormat.RAW
<cxf:binding>
<soap:soapBinding version="1.2"/>
</cxf:binding>