Here you can find the source of getSOAPHeader(SOAPMessageContext smc)
Parameter | Description |
---|---|
smc | a parameter |
Parameter | Description |
---|---|
SOAPException | an exception |
public static SOAPHeader getSOAPHeader(SOAPMessageContext smc) throws SOAPException
//package com.java2s; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.ws.handler.soap.SOAPMessageContext; public class Main { /**//from w ww . j a va 2s. c o m * Returns the header. If not present then adds one and return the same * * @param smc * @return * @throws SOAPException */ public static SOAPHeader getSOAPHeader(SOAPMessageContext smc) throws SOAPException { return smc.getMessage().getSOAPPart().getEnvelope().getHeader() == null ? smc.getMessage().getSOAPPart().getEnvelope().addHeader() : smc.getMessage().getSOAPPart().getEnvelope().getHeader(); } }