Add child elements to custom SOAP header in Spring-WS

后端 未结 4 853
清酒与你
清酒与你 2020-12-30 04:09

I am calling a SOAP webservice with Spring-WS. The webservice in question requires me to pass some information in the SOAP header as shown here:



        
4条回答
  •  一向
    一向 (楼主)
    2020-12-30 04:47

    I had the same issue and resolved it with the following snippet:

    Result result = ((SoapMessage) message).getSoapHeader().getResult();
    webServiceTemplate.getMarshaller().marshal(createCustomHeader(), result);
    

    The createCustomerHeader() method creates a JAXB bean which was generated from the XSD.

提交回复
热议问题