How do you add a Soap Header defined in a wsdl to a web service client in CXF?

后端 未结 4 1792
自闭症患者
自闭症患者 2020-12-11 10:55

I have a wsdl that defines a soap header that needs to be passed when calling the web service.

The sample SOAP Header is:


   &         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-11 11:46

    If the SOAP header is defined in the WSDL then it can either be specified implicit or explicit.

    CXF provides the wsdl2java tool for generating a Java service interface from a WSDL. In the case of explicit headers, the SOAP headers are automatically detected and made available as part of the service interface that gets generated.

    If the SOAP headers have been defined implicitly, then you need to enable the -exsh option which triggers processing of implicit SOAP headers. Again the SOAP headers will be made available as part of the service Java interface that gets generated. If you want a concrete example you can checkout a blog post I made on how to add a cxf soap header.

    Note that CXF also supports other ways of adding SOAP headers.

提交回复
热议问题