List of usage examples for javax.xml.soap SOAPBody getElementsByTagName
public NodeList getElementsByTagName(String name);
NodeList
of all descendant Elements
with a given tag name, in document order. From source file:net.bpelunit.test.unit.TestSOAPEncoder.java
@Test public void testEncodeRPCLitUnwrappedWithPartsInNamespaces() throws Exception { Element literal = TestUtil.readLiteralData(PATH_TO_FILES + "rpclit4.xmlfrag"); SOAPOperationCallIdentifier operation = TestUtil.getCall(PATH_TO_FILES, PARTNER_WSDL, PARTNER_OPERATION, SOAPOperationDirectionIdentifier.INPUT); ISOAPEncoder encoder = new RPCLiteralEncoder(); SOAPMessage message = encoder.construct(operation, literal, BPELUnitConstants.SOAP_FAULT_CODE_CLIENT, BPELUnitConstants.SOAP_FAULT_DESCRIPTION); final SOAPBody soapBody = message.getSOAPBody(); assertEquals(1, soapBody.getElementsByTagName("someFirstPart").getLength()); assertEquals(1, soapBody.getElementsByTagName("someSecondPart").getLength()); }
From source file:org.eevolution.LMX.engine.vendor.LMXFoliosDigitalesService.java
public String getXMLSealed(final String respxml) throws AdempiereException, IOException, SOAPException { String[] respuesta = null;/*w ww. j a v a2s . c o m*/ MessageFactory factory = MessageFactory.newInstance(); SOAPMessage message = factory.createMessage(new MimeHeaders(), new ByteArrayInputStream(respxml.getBytes(Charset.forName("UTF-8")))); SOAPBody body = message.getSOAPBody(); NodeList returnList = body.getElementsByTagName("TimbrarPruebaCFDIResult"); NodeList innerRes = returnList.item(0).getChildNodes(); boolean failed = false; respuesta = new String[innerRes.getLength()]; String messageError = null; for (int i = 0; i < innerRes.getLength(); i++) { respuesta[i] = innerRes.item(i).getTextContent(); if (i < 3 && !respuesta[i].equals("")) { failed = true; messageError = respuesta[i]; //System.out.println(messageError); } } if (failed) throw new AdempiereException(messageError); respuesta[3] = StringEscapeUtils.unescapeXml(respuesta[3]); return respuesta[3]; }