Java Code Examples for javax.xml.soap.Node#getLocalName()

The following examples show how to use javax.xml.soap.Node#getLocalName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InsurabilityHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void initMessageID(SOAPMessage msg) throws SOAPException {
	SOAPPart part = msg.getSOAPPart();
	if (part != null) {
		SOAPEnvelope soapEnvelope = part.getEnvelope();
		if (soapEnvelope != null) {
			SOAPHeader header = soapEnvelope.getHeader();
			
			if (header != null && header.getChildElements().hasNext()) {
				Node elementsResponseHeader = (Node) header.getChildElements().next();
				if (elementsResponseHeader != null && elementsResponseHeader.getLocalName() != null && elementsResponseHeader.getLocalName().equals("MessageID")) {
					NodeList elementsheader = elementsResponseHeader.getChildNodes();
					org.w3c.dom.Node element = elementsheader.item(0);
					messageId = element.getNodeValue();
					LOG.info("MyCareNet returned a response with messageId: " + messageId);
				}
			}
		}
	}
}
 
Example 2
Source File: InsurabilityHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void initMessageID(SOAPMessage msg) throws SOAPException {
   SOAPPart part = msg.getSOAPPart();
   if (part != null) {
      SOAPEnvelope soapEnvelope = part.getEnvelope();
      if (soapEnvelope != null) {
         SOAPHeader header = soapEnvelope.getHeader();
         if (header != null && header.getChildElements().hasNext()) {
            Node elementsResponseHeader = (Node)header.getChildElements().next();
            if (elementsResponseHeader != null && elementsResponseHeader.getLocalName() != null && elementsResponseHeader.getLocalName().equals("MessageID")) {
               NodeList elementsheader = elementsResponseHeader.getChildNodes();
               org.w3c.dom.Node element = elementsheader.item(0);
               messageId = element.getNodeValue();
               LOG.info("MyCareNet returned a response with messageId: " + messageId);
            }
         }
      }
   }

}
 
Example 3
Source File: InsurabilityHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void initMessageID(SOAPMessage msg) throws SOAPException {
	SOAPPart part = msg.getSOAPPart();
	if (part != null) {
		SOAPEnvelope soapEnvelope = part.getEnvelope();
		if (soapEnvelope != null) {
			SOAPHeader header = soapEnvelope.getHeader();
			
			if (header != null && header.getChildElements().hasNext()) {
				Node elementsResponseHeader = (Node) header.getChildElements().next();
				if (elementsResponseHeader != null && elementsResponseHeader.getLocalName() != null && elementsResponseHeader.getLocalName().equals("MessageID")) {
					NodeList elementsheader = elementsResponseHeader.getChildNodes();
					org.w3c.dom.Node element = elementsheader.item(0);
					messageId = element.getNodeValue();
					LOG.info("MyCareNet returned a response with messageId: " + messageId);
				}
			}
		}
	}
}
 
Example 4
Source File: InsurabilityHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void initMessageID(SOAPMessage msg) throws SOAPException {
	SOAPPart part = msg.getSOAPPart();
	if (part != null) {
		SOAPEnvelope soapEnvelope = part.getEnvelope();
		if (soapEnvelope != null) {
			SOAPHeader header = soapEnvelope.getHeader();
			
			if (header != null && header.getChildElements().hasNext()) {
				Node elementsResponseHeader = (Node) header.getChildElements().next();
				if (elementsResponseHeader != null && elementsResponseHeader.getLocalName() != null && elementsResponseHeader.getLocalName().equals("MessageID")) {
					NodeList elementsheader = elementsResponseHeader.getChildNodes();
					org.w3c.dom.Node element = elementsheader.item(0);
					messageId = element.getNodeValue();
					LOG.info("MyCareNet returned a response with messageId: " + messageId);
				}
			}
		}
	}
}
 
Example 5
Source File: WsaDecoder.java    From arctic-sea with Apache License 2.0 5 votes vote down vote up
@Override
public List<WsaHeader> decode(List<SOAPHeaderElement> list) {
    List<WsaHeader> wsaHeaders = Lists.newArrayListWithCapacity(list.size());
    boolean to = false;
    boolean replyTo = false;
    boolean messageId = false;
    boolean action = false;
    for (SOAPHeaderElement soapHeaderElement : list) {
        if (soapHeaderElement.getLocalName().equals(WsaConstants.EN_TO)) {
            wsaHeaders.add(new WsaToHeader(soapHeaderElement.getValue()));
            to = true;
        } else if (soapHeaderElement.getLocalName().equals(WsaConstants.EN_ACTION)) {
            wsaHeaders.add(new WsaActionHeader(soapHeaderElement.getValue()));
            action = true;
        } else if (soapHeaderElement.getLocalName().equals(WsaConstants.EN_REPLY_TO)) {
            Iterator<?> iter = soapHeaderElement.getChildElements();
            while (iter.hasNext()) {
                Node node = (Node) iter.next();
                if (node.getLocalName() != null && node.getLocalName().equals(WsaConstants.EN_ADDRESS)) {
                    wsaHeaders.add(new WsaReplyToHeader(node.getValue()));
                    replyTo = true;
                }
            }
        } else if (soapHeaderElement.getLocalName().equals(WsaConstants.EN_MESSAGE_ID)) {
            wsaHeaders.add(new WsaMessageIDHeader(soapHeaderElement.getValue()));
            messageId = true;
        }
    }
    if ((to || replyTo || messageId) && !action) {
        wsaHeaders.add(new WsaActionHeader(WsaConstants.WSA_FAULT_ACTION));
    }
    return wsaHeaders;
}