wsimport doesnt generate code related to soap headers

六眼飞鱼酱① 提交于 2019-11-30 04:49:21

I could not comment so I am writing this here as an "answer".

I ran into the same situation where there was only body in the envelope. However after adding the '-XadditionalHeaders' argument, wsimport still refused to generate service methods with header arguments. I searched on the Internet and found a manual patch in the following link:

https://metro.java.net/2.0/guide/SOAP_headers.html

I did not do it in the code. Instead I changed the method signature of the web service operation method by adding arguments for the request header and annotating them with @WebParam(header=true). I have not tested it with a real web service server, but at least the SOAP message now looks correct (no longer headless).

-exsh (true/false)

Enables or disables processing of implicit SOAP headers (i.e. SOAP headers defined in the wsdl:binding but not wsdl:portType section.) Processing the SOAP headers requires the SOAP binding jars available on the classpath which was not the default in CXF 2.4.x and older. You may need to add a dependency to cxf-rt-binding-soap for this flag to work. Default is false.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!