wsimport doesnt generate code related to soap headers

前端 未结 2 1615
谎友^
谎友^ 2020-12-28 16:20

I\'m generating client java code from a wsdl using \'wsimport\'. The wsdl has soap:header in the operation definitions like this



        
相关标签:
2条回答
  • 2020-12-28 17:01

    -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.

    0 讨论(0)
  • 2020-12-28 17:23

    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).

    0 讨论(0)
提交回复
热议问题