How to change “SOAP-ENV” default prefix of Spring-WS

后端 未结 3 2156
清歌不尽
清歌不尽 2021-02-13 15:29

I\'ve created a web service using Spring-WS. To maintain compatibility with the old system, I need to change namespace prefix from SOAP-ENV to soap.

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-13 15:37

    I use SAAJ. Try this.

    1. soapEnvelope.removeNamespaceDeclaration("SOAP-ENV");
    2. soapEnvelope.addNamespaceDeclaration("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
    3. soapEnvelope.setPrefix("soapenv");
    4. soapHeader.setPrefix("soapenv");
    5. soapBody.setPrefix("soapenv");

    Don't forget: soapMessage.saveChanges();

    Reference:Changing the default XML namespace prefix generated with JAXWS

提交回复
热议问题