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

The following examples show how to use javax.xml.soap.Node#getChildNodes() . 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: LoggingHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void getMessageID(SOAPMessage msg) throws SOAPException {
   SOAPHeader header = msg.getSOAPHeader();
   if (header != null && header.getChildElements().hasNext()) {
      Node elementsResponseHeader = (Node)header.getChildElements().next();
      NodeList elementsheader = elementsResponseHeader.getChildNodes();

      for(int i = 0; i < elementsheader.getLength(); ++i) {
         org.w3c.dom.Node element = elementsheader.item(i);
         if (element.getLocalName() != null && element.getLocalName().equals("MessageID")) {
            LOG.info("The message id of the response: " + element.getNodeValue());
            break;
         }
      }
   }

}
 
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: LoggingHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void getMessageID(SOAPMessage msg) throws SOAPException {
   SOAPHeader header = msg.getSOAPHeader();
   if (header != null && header.getChildElements().hasNext()) {
      Node elementsResponseHeader = (Node)header.getChildElements().next();
      NodeList elementsheader = elementsResponseHeader.getChildNodes();

      for(int i = 0; i < elementsheader.getLength(); ++i) {
         org.w3c.dom.Node element = elementsheader.item(i);
         if (element.getLocalName() != null && element.getLocalName().equals("MessageID")) {
            LOG.info("The message id of the response: " + element.getNodeValue());
            break;
         }
      }
   }

}
 
Example 6
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 7
Source File: InsurabilityHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public boolean handleMessage(SOAPMessageContext c) {
   try {
      Boolean outboundProperty = (Boolean)c.get("javax.xml.ws.handler.message.outbound");
      if (!outboundProperty.booleanValue()) {
         SOAPMessage msg = c.getMessage();
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         msg.writeTo(out);
         Node elementsGetPrescriptionForExecutorResponse = (Node)msg.getSOAPBody().getChildElements().next();
         NodeList elements = elementsGetPrescriptionForExecutorResponse.getChildNodes();

         for(int i = 0; i < elements.getLength(); ++i) {
            org.w3c.dom.Node element = elements.item(i);
            if (element.getLocalName() != null && (element.getLocalName().equals("GetInsurabilityForPharmacistResponse") || element.getLocalName().equals("InsurabilityResponse"))) {
               initMessageID(msg);
               Transformer t = TransformerFactory.newInstance().newTransformer();
               StringWriter sw = new StringWriter();
               t.transform(new DOMSource(element), new StreamResult(sw));
               insurability = sw.toString();
               break;
            }
         }
      }
   } catch (Throwable var11) {
      LOG.warn("SOAPException when retrieving insurability the message", var11);
   }

   return true;
}