Java Code Examples for javax.xml.soap.SOAPElement#getChildElements()
The following examples show how to use
javax.xml.soap.SOAPElement#getChildElements() .
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: AarXTeeConsumerCallback.java From j-road with Apache License 2.0 | 6 votes |
@Override public void doWithMessage(WebServiceMessage request) throws IOException, TransformerException { callback.doWithMessage(request); SaajSoapMessage message = (SaajSoapMessage) request; SOAPMessage mes = message.getSaajMessage(); try { SOAPBody body = mes.getSOAPBody(); SOAPElement queryEle = (SOAPElement) body.getChildElements().next(); SOAPElement kehaEle = (SOAPElement) queryEle.getChildElements().next(); java.util.Iterator kehaChilds = kehaEle.getChildElements(); while (kehaChilds.hasNext()) { Object nextEle = kehaChilds.next(); if (nextEle instanceof SOAPElement) { addType((SOAPElement) nextEle); } } } catch(Exception ex) { ex.printStackTrace(); } }
Example 2
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 6 votes |
public MessageSnapshot(MessageContext soapMessage) { SOAPMessage message = ((SOAPMessageContext) soapMessage).getMessage(); if (message == null || message.getSOAPPart() == null) { operationName = null; parameterNames = null; } else { SOAPBody body = getBody(message); SOAPElement operation = ((SOAPElement) body.getChildElements().next()); this.operationName = operation.getElementName().toString(); this.parameterNames = new ArrayList<String>(); for (Iterator i = operation.getChildElements(); i.hasNext(); ) { SOAPElement parameter = (SOAPElement) i.next(); String element = parameter.getElementName().toString(); parameterNames.add(element); } } }
Example 3
Source File: Fault1_2Impl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Iterator<QName> getFaultSubcodes() { if (this.faultCodeElement == null) findFaultCodeElement(); final List<QName> subcodeList = new ArrayList<>(); SOAPElement currentCodeElement = this.faultCodeElement; Iterator subcodeElements = currentCodeElement.getChildElements(subcodeName); while (subcodeElements.hasNext()) { currentCodeElement = (ElementImpl) subcodeElements.next(); Iterator valueElements = currentCodeElement.getChildElements(valueName); SOAPElement valueElement = (SOAPElement) valueElements.next(); String code = valueElement.getValue(); subcodeList.add(convertCodeToQName(code, valueElement)); subcodeElements = currentCodeElement.getChildElements(subcodeName); } //return subcodeList.iterator(); return new Iterator<QName>() { Iterator<QName> subCodeIter = subcodeList.iterator(); @Override public boolean hasNext() { return subCodeIter.hasNext(); } @Override public QName next() { return subCodeIter.next(); } @Override public void remove() { throw new UnsupportedOperationException( "Method remove() not supported on SubCodes Iterator"); } }; }
Example 4
Source File: JRXmlaQueryExecuter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void parseAxesInfoElement(SOAPElement axesInfoElement) throws SOAPException { // Cycle over AxisInfo-Elements Name axisInfoName = sf.createName("AxisInfo", "", MDD_URI); Iterator<?> itAxis = axesInfoElement.getChildElements(axisInfoName); while (itAxis.hasNext()) { SOAPElement axisElement = (SOAPElement) itAxis.next(); Name name = sf.createName("name"); String axisName = axisElement.getAttributeValue(name); if (axisName.equals(SLICER_AXIS_NAME)) { continue; } JRXmlaResultAxis axis = new JRXmlaResultAxis(axisName); xmlaResult.addAxis(axis); if (log.isDebugEnabled()) { log.debug("adding axis: " + axis.getAxisName()); } // retrieve the hierarchies by <HierarchyInfo> name = sf.createName("HierarchyInfo", "", MDD_URI); Iterator<?> itHierInfo = axisElement.getChildElements(name); while (itHierInfo.hasNext()) { SOAPElement eHierInfo = (SOAPElement) itHierInfo.next(); handleHierInfo(axis, eHierInfo); } } }
Example 5
Source File: JRXmlaQueryExecuter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void parseAxesElement(SOAPElement axesElement) throws SOAPException { // Cycle over Axis-Elements Name aName = sf.createName("Axis", "", MDD_URI); Iterator<?> itAxis = axesElement.getChildElements(aName); while (itAxis.hasNext()) { SOAPElement axisElement = (SOAPElement) itAxis.next(); Name name = sf.createName("name"); String axisName = axisElement.getAttributeValue(name); if (axisName.equals(SLICER_AXIS_NAME)) { continue; } // LookUp for the Axis JRXmlaResultAxis axis = xmlaResult.getAxisByName(axisName); // retrieve the tuples by <Tuples> name = sf.createName("Tuples", "", MDD_URI); Iterator<?> itTuples = axisElement.getChildElements(name); if (itTuples.hasNext()) { SOAPElement eTuples = (SOAPElement) itTuples.next(); handleTuplesElement(axis, eTuples); } } }
Example 6
Source File: JRXmlaQueryExecuter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void handleCellErrors(Iterator<?> errorElems) throws SOAPException { SOAPElement errorElem = (SOAPElement) errorElems.next(); StringBuilder errorMsg = new StringBuilder(); errorMsg.append("Cell error: "); Iterator<?> descriptionElems = errorElem.getChildElements(sf.createName("Description", "", MDD_URI)); if (descriptionElems.hasNext()) { SOAPElement descrElem = (SOAPElement) descriptionElems.next(); errorMsg.append(descrElem.getValue()); errorMsg.append("; "); } Iterator<?> sourceElems = errorElem.getChildElements(sf.createName("Source", "", MDD_URI)); if (sourceElems.hasNext()) { SOAPElement sourceElem = (SOAPElement) sourceElems.next(); errorMsg.append("Source: "); errorMsg.append(sourceElem.getValue()); errorMsg.append("; "); } Iterator<?> codeElems = errorElem.getChildElements(sf.createName("ErrorCode", "", MDD_URI)); if (codeElems.hasNext()) { SOAPElement codeElem = (SOAPElement) codeElems.next(); errorMsg.append("Code: "); errorMsg.append(codeElem.getValue()); errorMsg.append("; "); } throw new JRRuntimeException(errorMsg.toString()); }
Example 7
Source File: JRXmlaQueryExecuter.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void handleTuplesElement(JRXmlaResultAxis axis, SOAPElement tuplesElement) throws SOAPException { Name tName = sf.createName("Tuple", "", MDD_URI); for (Iterator<?> itTuple = tuplesElement.getChildElements(tName); itTuple.hasNext();) { SOAPElement eTuple = (SOAPElement) itTuple.next(); handleTupleElement(axis, eTuple); } }
Example 8
Source File: AarXTeeConsumerCallback.java From j-road with Apache License 2.0 | 5 votes |
private void addType(SOAPElement ele) { if (eleAttrs.containsKey(ele.getElementName().getLocalName())) { Attribute attr = eleAttrs.get(ele.getElementName().getLocalName()); ele.setAttribute(attr.getAttrName(), attr.getAttrValue()); } java.util.Iterator eleChilds = ele.getChildElements(); while (eleChilds.hasNext()) { Object nextEle = eleChilds.next(); if (nextEle instanceof SOAPElement) { addType((SOAPElement) nextEle); } } }
Example 9
Source File: AbstractTypeTestClient3.java From cxf with Apache License 2.0 | 5 votes |
public void assertEquals(Element elA, Element elB) throws Exception { if (elA instanceof SOAPElement && elB instanceof SOAPElement) { SOAPElement soapA = (SOAPElement)elA; SOAPElement soapB = (SOAPElement)elB; Assert.assertEquals("StructWithAny soap element names don't match", soapA.getElementName(), soapB.getElementName()); Assert.assertEquals("StructWithAny soap element text nodes don't match", soapA.getValue(), soapB.getValue()); Iterator<?> itExp = soapA.getChildElements(); Iterator<?> itGen = soapB.getChildElements(); while (itExp.hasNext()) { if (!itGen.hasNext()) { fail("Incorrect number of child elements inside any"); } Object objA = itExp.next(); Object objB = itGen.next(); if (objA instanceof SOAPElement) { if (objB instanceof SOAPElement) { assertEquals((SOAPElement)objA, (SOAPElement)objB); } else { fail("No matching soap element."); } } } } }
Example 10
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 5 votes |
private boolean equals(SOAPMessageContext soapMessage) { SOAPMessage message = soapMessage.getMessage(); if (operationName == null) { return message == null || message.getSOAPPart() == null; } SOAPBody body = getBody(message); // Handlers can't change the operation SOAPElement operation = ((SOAPElement) body.getChildElements().next()); if (!this.operationName.equals(operation.getElementName().toString())) { return false; } Iterator parameters = operation.getChildElements(); for (Iterator i = parameterNames.iterator(); i.hasNext(); ) { // Handlers can't remove parameters if (!parameters.hasNext()) { return false; } String original = (String) i.next(); SOAPElement parameter = (SOAPElement) parameters.next(); // Handlers can't change parameter types if (parameter == null || !original.equals(parameter.getElementName().toString())) { return false; } } // Handlers can't add parameters return !parameters.hasNext(); }
Example 11
Source File: JRXmlaQueryExecuter.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected void parseCellDataElement(SOAPElement cellDataElement) throws SOAPException { Name name = sf.createName("Cell", "", MDD_URI); Iterator<?> itCells = cellDataElement.getChildElements(name); while (itCells.hasNext()) { SOAPElement cellElement = (SOAPElement) itCells.next(); Name errorName = sf.createName("Error", "", MDD_URI); Iterator<?> errorElems = cellElement.getChildElements(errorName); if (errorElems.hasNext()) { handleCellErrors(errorElems); } Name ordinalName = sf.createName("CellOrdinal"); String cellOrdinal = cellElement.getAttributeValue(ordinalName); Object value = null; Iterator<?> valueElements = cellElement.getChildElements(sf.createName("Value", "", MDD_URI)); if (valueElements.hasNext()) { SOAPElement valueElement = (SOAPElement) valueElements.next(); String valueType = valueElement.getAttribute("xsi:type"); if (valueType.equals("xsd:int")) { value = Long.valueOf(valueElement.getValue()); } else if ( valueType.equals("xsd:double") || valueType.equals("xsd:decimal") ) { value = Double.valueOf(valueElement.getValue()); } else { value = valueElement.getValue(); } } String fmtValue = ""; Iterator<?> fmtValueElements = cellElement.getChildElements(sf.createName("FmtValue", "", MDD_URI)); if (fmtValueElements.hasNext()) { SOAPElement fmtValueElement = ((SOAPElement) fmtValueElements.next()); fmtValue = fmtValueElement.getValue(); } int pos = Integer.parseInt(cellOrdinal); JRXmlaCell cell = new JRXmlaCell(value, fmtValue); xmlaResult.setCell(cell, pos); } }
Example 12
Source File: JRXmlaQueryExecuter.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected void handleTupleElement(JRXmlaResultAxis axis, SOAPElement tupleElement) throws SOAPException { JRXmlaMemberTuple tuple = new JRXmlaMemberTuple(axis.getHierarchiesOnAxis().length); Name memName = sf.createName("Member", "", MDD_URI); Iterator<?> itMember = tupleElement.getChildElements(memName); int memNum = 0; while (itMember.hasNext()) { SOAPElement memElement = (SOAPElement) itMember.next(); Name name = sf.createName("Hierarchy", "", ""); String hierName = memElement.getAttributeValue(name); String uName = ""; Iterator<?> uNameElements = memElement.getChildElements(sf.createName("UName", "", MDD_URI)); if (uNameElements.hasNext()) { uName = ((SOAPElement) uNameElements.next()).getValue(); } String caption = ""; Iterator<?> captionElements = memElement.getChildElements(sf.createName("Caption", "", MDD_URI)); if (captionElements.hasNext()) { caption = ((SOAPElement) captionElements.next()).getValue(); } String lName = ""; Iterator<?> lNameElements = memElement.getChildElements(sf.createName("LName", "", MDD_URI)); if (lNameElements.hasNext()) { String levelUniqueName = ((SOAPElement) lNameElements.next()).getValue(); Matcher matcher = LEVEL_UNIQUE_NAME_PATTERN.matcher(levelUniqueName); if (matcher.matches()) { lName = matcher.group(LEVEL_UNIQUE_NAME_PATTERN_NAME_GROUP); } else { matcher = HIERARCHY_LEVEL_UNIQUE_NAME_PATTERN.matcher(levelUniqueName); if (matcher.matches()) { lName = matcher.group(HIERARCHY_LEVEL_UNIQUE_NAME_PATTERN_NAME_GROUP); } else { throw new JRRuntimeException( EXCEPTION_MESSAGE_KEY_XMLA_NO_LEVEL_NAME, new Object[]{levelUniqueName}); } } } int lNum = 0; Iterator<?> lNumElements = memElement.getChildElements(sf.createName("LNum", "", MDD_URI)); if (lNumElements.hasNext()) { lNum = Integer.parseInt(((SOAPElement) lNumElements.next()).getValue()); } JRXmlaMember member = new JRXmlaMember(caption, uName, hierName, lName, lNum); if (log.isDebugEnabled()) { log.debug("Adding member: axis - " + axis.getAxisName() + " hierName - " + hierName + " lName - " + lName + " uName - " + uName); } tuple.setMember(memNum++, member); } axis.addTuple(tuple); }