Search in sources :

Example 1 with SOAPHeaderElement

use of jakarta.xml.soap.SOAPHeaderElement in project openmq by eclipse-ee4j.

the class MessageUtil method newMessageInstance.

public static SOAPMessage newMessageInstance() throws SOAPException {
    SOAPMessage soapm = null;
    /**
     * sync create new instance to make sure to work in ALL SAAJ impl.
     */
    synchronized (syncObj) {
        soapm = messageFactory.createMessage();
    }
    SOAPHeader sh = soapm.getSOAPHeader();
    SOAPHeaderElement she = addJMSNsSOAPHeaderElement(sh, Constants.MESSAGE_HEADER);
    addMessageHeaderChildElements(she);
    soapm.saveChanges();
    return soapm;
}
Also used : SOAPHeaderElement(jakarta.xml.soap.SOAPHeaderElement) SOAPMessage(jakarta.xml.soap.SOAPMessage) SOAPHeader(jakarta.xml.soap.SOAPHeader)

Example 2 with SOAPHeaderElement

use of jakarta.xml.soap.SOAPHeaderElement in project openmq by eclipse-ee4j.

the class MessageUtil method addJMSPropertyElement.

public static SOAPHeaderElement addJMSPropertyElement(SOAPHeader sheader) throws SOAPException {
    SOAPHeaderElement she = null;
    // Name pname = createJMSName (Constants.JMS_PROPERTY);
    // System.out.println("*** JMS property exists: " + pname.getQualifiedName());
    she = getJMSPropertyElement(sheader);
    if (she == null) {
        she = addJMSNsSOAPHeaderElement(sheader, InternalConstants.JMS_PROPERTY);
    }
    return she;
}
Also used : SOAPHeaderElement(jakarta.xml.soap.SOAPHeaderElement)

Example 3 with SOAPHeaderElement

use of jakarta.xml.soap.SOAPHeaderElement in project openmq by eclipse-ee4j.

the class MessageUtil method getSOAPHeaderElement.

public static SOAPHeaderElement getSOAPHeaderElement(SOAPMessage message, String headerName, String nameSpace) throws SOAPException {
    Iterator it = message.getSOAPHeader().examineAllHeaderElements();
    while (it.hasNext()) {
        SOAPHeaderElement she = (SOAPHeaderElement) it.next();
        String uri = she.getNamespaceURI();
        String localName = she.getLocalName();
        if (headerName.equals(localName) && nameSpace.equals(uri)) {
            // found message header.
            return she;
        }
    }
    return null;
}
Also used : SOAPHeaderElement(jakarta.xml.soap.SOAPHeaderElement) Iterator(java.util.Iterator)

Example 4 with SOAPHeaderElement

use of jakarta.xml.soap.SOAPHeaderElement in project openmq by eclipse-ee4j.

the class MessageUtil method checkJMSMessageHeader.

public static void checkJMSMessageHeader(SOAPMessage sm) throws SOAPException {
    SOAPHeaderElement msgHeader = getMessageHeaderElement(sm);
    if (msgHeader != null) {
        msgHeader.detachNode();
    }
    addMessageHeader(sm);
}
Also used : SOAPHeaderElement(jakarta.xml.soap.SOAPHeaderElement)

Example 5 with SOAPHeaderElement

use of jakarta.xml.soap.SOAPHeaderElement in project openmq by eclipse-ee4j.

the class MessageUtil method getServiceAttribute.

public static String getServiceAttribute(SOAPMessage soapm, String localName) throws SOAPException {
    SOAPHeaderElement mh = getMessageHeaderElement(soapm);
    SOAPElement serviceElement = getJMSChildElement(mh, Constants.SERVICE);
    if (serviceElement == null) {
        throw new SOAPException("Message does not contain a Service SOAP Header Element.");
    }
    Name n = createJMSName(localName);
    String value = serviceElement.getAttributeValue(n);
    return value;
}
Also used : SOAPHeaderElement(jakarta.xml.soap.SOAPHeaderElement) SOAPException(jakarta.xml.soap.SOAPException) SOAPElement(jakarta.xml.soap.SOAPElement) Name(jakarta.xml.soap.Name)

Aggregations

SOAPHeaderElement (jakarta.xml.soap.SOAPHeaderElement)26 SOAPHeader (jakarta.xml.soap.SOAPHeader)15 SOAPElement (jakarta.xml.soap.SOAPElement)6 Iterator (java.util.Iterator)6 QName (javax.xml.namespace.QName)5 SAAJHeader (com.sun.xml.ws.message.saaj.SAAJHeader)4 Name (jakarta.xml.soap.Name)4 Header (com.sun.xml.ws.api.message.Header)3 SOAPMessage (jakarta.xml.soap.SOAPMessage)2 ArrayList (java.util.ArrayList)2 MessageHeaders (com.sun.xml.ws.api.message.MessageHeaders)1 SAAJMessageHeaders (com.sun.xml.ws.api.message.saaj.SAAJMessageHeaders)1 SOAPBindingImpl (com.sun.xml.ws.binding.SOAPBindingImpl)1 StringHeader (com.sun.xml.ws.message.StringHeader)1 SOAPException (jakarta.xml.soap.SOAPException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1