Java SOAP Message getSOAPHeader(SOAPMessageContext smc)

Here you can find the source of getSOAPHeader(SOAPMessageContext smc)

Description

Returns the header.

License

Open Source License

Parameter

Parameter Description
smc a parameter

Exception

Parameter Description
SOAPException an exception

Declaration

public static SOAPHeader getSOAPHeader(SOAPMessageContext smc) throws SOAPException 

Method Source Code

//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();
    }
}

Related

  1. getNode(Node node, String nodeName)
  2. getPrefix(Name name)
  3. getPrefix(String namespaceURI, SOAPElement contextElem)
  4. getSOAPData(SOAPMessage soapMessage)
  5. getSoapFaultExceptionMessage(SOAPFaultException sfe)
  6. getSOAPHeaderElement(SOAPMessage message, String headerName, String nameSpace)
  7. getSOAPMessage(InputStream in)
  8. getSOAPMessage(InputStream is)
  9. getSOAPMessage(Map headerMap, InputStream is)