List of usage examples for javax.xml.soap SOAPElement getNodeName
public String getNodeName();
From source file:hk.hku.cecid.corvus.ws.EBMSMessageHistoryQuerySenderTest.java
private String getElementValue(SOAPElement msgBody, String name) { Iterator iterator = msgBody.getChildElements(); while (iterator.hasNext()) { SOAPElement current = (SOAPElement) iterator.next(); if (current.getNodeName().equalsIgnoreCase(name)) return current.getValue(); }//from w w w . jav a 2 s .c o m return null; }
From source file:org.apache.axis2.saaj.SOAPFactoryTest.java
@Validated @Test// w ww . ja va 2 s .co m public void testCreateElement2() { try { SOAPFactory sf = SOAPFactory.newInstance(); //SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); if (sf == null) { fail("could not create SOAPFactory object"); } log.info("Create a DOMElement"); DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbfactory.newDocumentBuilder(); Document document = builder.newDocument(); Element de = document.createElementNS("http://MyNamespace.org/", "MyTag"); //Calling SOAPFactory.createElement(org.w3c.dom.Element) SOAPElement se = sf.createElement(de); if (!de.getNodeName().equals(se.getNodeName()) || !de.getNamespaceURI().equals(se.getNamespaceURI())) { //Node names are not equal fail("Got: <URI=" + se.getNamespaceURI() + ", PREFIX=" + se.getPrefix() + ", NAME=" + se.getNodeName() + ">" + "Expected: <URI=" + de.getNamespaceURI() + ", PREFIX=" + de.getPrefix() + ", NAME=" + de.getNodeName() + ">"); } } catch (Exception e) { fail("Exception: " + e); } }
From source file:org.apache.axis2.saaj.SOAPFactoryTest.java
@Validated @Test/*from w w w .java 2 s .c o m*/ public void testCreateElement4() { try { SOAPFactory sf = SOAPFactory.newInstance(); if (sf == null) { fail("createElementTest6() could not create SOAPFactory object"); } QName qname = new QName("http://MyNamespace.org/", "MyTag"); SOAPElement se1 = sf.createElement(qname); //Create second SOAPElement from first SOAPElement SOAPElement se2 = sf.createElement(se1); //commented to support jdk 1.4 build // if(!se1.isEqualNode(se2) && !se1.isSameNode(se2)) { // fail("The SOAPElement's are not equal and not the same (unexpected)"); // } if (!se1.getNodeName().equals(se2.getNodeName()) || !se1.getNamespaceURI().equals(se2.getNamespaceURI())) { fail("Got: <URI=" + se1.getNamespaceURI() + ", PREFIX=" + se1.getPrefix() + ", NAME=" + se1.getNodeName() + ">" + "Expected: <URI=" + se2.getNamespaceURI() + ", PREFIX=" + se2.getPrefix() + ", NAME=" + se2.getNodeName() + ">"); } } catch (Exception e) { fail(); } }
From source file:org.jbpm.bpel.integration.soap.SoapUtil.java
public static void copyChildElement(Element parent, SOAPElement source) { // create a DOM element with the same name as the source String namespaceURI = source.getNamespaceURI(); String qualifiedName = source.getNodeName(); Element target = parent.getOwnerDocument().createElementNS(namespaceURI, qualifiedName); parent.appendChild(target);//from w w w. j ava 2 s. c om if (traceEnabled) log.trace("appended element: {" + namespaceURI + '}' + qualifiedName); // namespaces copyNamespaces(target, source); XmlUtil.ensureOwnNamespaceDeclared(target); // attributes copyAttributes(target, source); // child nodes copyChildNodes(target, source); }
From source file:org.olat.modules.vitero.manager.ViteroManager.java
private String extractErrorCode(SOAPElement element) { if (element == null) return null; for (Iterator<?> it = element.getChildElements(); it.hasNext();) { Object childElement = it.next(); if (childElement instanceof SOAPElement) { SOAPElement soapElement = (SOAPElement) childElement; String nodeName = soapElement.getNodeName(); if ("errorCode".equals(nodeName)) { return extractText(soapElement); } else { extractErrorCode(soapElement); }//from ww w. ja v a 2s.co m } } return null; }