Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 701

add header in springboot saop ws responde

$
0
0

I wrote a SOAP web service with spring boot and it works fine, I just want to add any element in the header for a test but I can't find how to do it, can you help me?

    @Endpoint    public class WebServiceEndpoint {    private static final Logger LOGGER = LoggerFactory.getLogger(WebServiceEndpoint.class);        @PayloadRoot(namespace = "http://license", localPart = "getContentInfo")        @ResponsePayload        @ResponseStatus(code = HttpStatus.OK, reason = "OK")        public JAXBElement <getContentInfoResponse> getRequest(@RequestPayload JAXBElement<getContentInfo> request, MessageContext messageContext) {            getContentInfoResponse response = new getContentInfoResponse();            ResponseLicense responseLicense = new ResponseLicense();            responseLicense.setPlayHoursRemained(23456);            responseLicense.setPlaysRemained(-1);            responseLicense.setResultCode(0);            //responseLicense.setResultMessage("");            response.setGetContentInfoReturn(responseLicense);            JAXBElement<getContentInfoResponse> xml = createJaxbElement(response, getContentInfoResponse.class);            return xml;          }          private JAXBElement <getContentInfoResponse > createJaxbElement(getContentInfoResponse response, Class<getContentInfoResponse> clazz) {              JAXBElement<getContentInfoResponse> xml = new JAXBElement<getContentInfoResponse>(new QName(clazz.getSimpleName()), clazz, response);              return xml;          }}

this is what I would like...

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><ID>1234</<ID><SOAP-ENV:Header/><SOAP-ENV:Body><getContentInfoResponse xmlns:ns2="http://license"><ns2:getContentInfoReturn><ns2:playHoursRemained>23456</ns2:playHoursRemained><ns2:playsRemained>-1</ns2:playsRemained><ns2:properties xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><ns2:resultCode>0</ns2:resultCode><ns2:resultMessage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></ns2:getContentInfoReturn></getContentInfoResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Viewing all articles
Browse latest Browse all 701

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>