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

后端 未结 4 1795
自闭症患者
自闭症患者 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条回答
  •  旧时难觅i
    2020-12-11 11:44

    Well, the most simple way to do this would be create an ArrayList of Header objects and add all your parameters or a Map and add all your headers as map.put("param1",param1).

    Finally get your request context and add this arraylist of map as

    requestContext.put(MessageContext.HTTP_REQUEST_HEADERS,
    soapHeaders); 
    

    If you're trying to pass custom soap headers, refer THIS LINK.

    The general pitfalls have been mentioned in THIS DISCUSSION. It might be helpful to you.

提交回复
热议问题