List of usage examples for javax.xml.soap SOAPHeader getChildNodes
public NodeList getChildNodes();
NodeList
that contains all children of this node. From source file:com.betfair.testing.utils.cougar.helpers.CougarHelpers.java
private void extractHeaderDataSOAP(SOAPMessage response, HttpResponseBean responseBean) throws SOAPException { //extract MimeHeaders MimeHeaders mime = response.getMimeHeaders(); Iterator<MimeHeader> iter = mime.getAllHeaders(); while (iter.hasNext()) { MimeHeader mimeH = iter.next(); responseBean.addEntryToResponseHeaders(mimeH.getName(), mimeH.getValue()); }// w w w.java2 s.c o m //extract SOAPHeaders from the envelope and a them to the mimeHeaders if (response.getSOAPHeader() != null) { javax.xml.soap.SOAPHeader header = response.getSOAPHeader(); NodeList nodes = header.getChildNodes(); for (int x = 0; x < nodes.getLength(); x++) { //if the header entry contains child nodes - write them with the node names if (nodes.item(x).hasChildNodes()) { NodeList childnodes = nodes.item(x).getChildNodes(); for (int y = 0; y < childnodes.getLength(); y++) { responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(), childnodes.item(y).getLocalName() + ":" + childnodes.item(y).getTextContent()); } } else { responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(), nodes.item(x).getTextContent()); } } } }