List of usage examples for javax.xml.soap Name getLocalName
String getLocalName();
From source file:org.apache.axis.message.MessageElement.java
/** * add the child element//from w w w.j a v a2 s .c o m * @param childName uri, prefix and local name of the element to add * @return the child element * @throws SOAPException * @see javax.xml.soap.SOAPElement#addChildElement(javax.xml.soap.Name) */ public SOAPElement addChildElement(Name childName) throws SOAPException { MessageElement child = new MessageElement(childName.getLocalName(), childName.getPrefix(), childName.getURI()); addChild(child); return child; }
From source file:org.apache.axis.message.MessageElement.java
/** * add a new attribute/*from w ww. ja v a2s . c om*/ * @param attrName name of the attribute * @param value a string value * @return ourselves * @throws SOAPException * @see javax.xml.soap.SOAPElement#addAttribute(javax.xml.soap.Name, String) */ public SOAPElement addAttribute(Name attrName, String value) throws SOAPException { try { addAttribute(attrName.getPrefix(), attrName.getURI(), attrName.getLocalName(), value); } catch (RuntimeException t) { throw new SOAPException(t); } return this; }
From source file:org.apache.axis.message.MessageElement.java
/** * Get the value of an attribute whose namespace and local name are described. * @param attrName qualified name of the attribute * @return the attribute or null if there was no match * @see SOAPElement#getAttributeValue(javax.xml.soap.Name) *//*from w w w . j a va2 s . c o m*/ public String getAttributeValue(Name attrName) { return attributes.getValue(attrName.getURI(), attrName.getLocalName()); }
From source file:org.apache.axis.message.MessageElement.java
/** * remove an element// w w w. j a v a2 s. co m * @param attrName name of the element * @return true if the attribute was found and removed. * @see javax.xml.soap.SOAPElement#removeAttribute(javax.xml.soap.Name) */ public boolean removeAttribute(Name attrName) { AttributesImpl attributes = makeAttributesEditable(); boolean removed = false; for (int i = 0; i < attributes.getLength() && !removed; i++) { if (attributes.getURI(i).equals(attrName.getURI()) && attributes.getLocalName(i).equals(attrName.getLocalName())) { attributes.removeAttribute(i); removed = true; } } return removed; }
From source file:org.apache.axis.message.MessageElement.java
/** * get an iterator over child elements/*from w ww. ja va2 s. co m*/ * @param qname namespace/element name of parts to find. * This iterator is not (currently) susceptible to change in the element * list during its lifetime, though changes in the contents of the elements * are picked up. * @return an iterator. */ public Iterator getChildElements(QName qname) { initializeChildren(); int num = children.size(); Vector c = new Vector(num); for (int i = 0; i < num; i++) { MessageElement child = (MessageElement) children.get(i); Name cname = child.getElementName(); if (cname.getURI().equals(qname.getNamespaceURI()) && cname.getLocalName().equals(qname.getLocalPart())) { c.add(child); } } return c.iterator(); }
From source file:org.apache.axis.message.MessageElement.java
/** * get an iterator over child elements// w w w .jav a2s.com * @param childName namespace/element name of parts to find. * This iterator is not (currently) susceptible to change in the element * list during its lifetime, though changes in the contents of the elements * are picked up. * @return an iterator. * @see javax.xml.soap.SOAPElement#getChildElements(javax.xml.soap.Name) */ public Iterator getChildElements(Name childName) { return getChildElements(new QName(childName.getURI(), childName.getLocalName())); }
From source file:org.apache.axis.message.SOAPBody.java
public javax.xml.soap.SOAPFault addFault(Name name, String s, Locale locale) throws SOAPException { AxisFault af = new AxisFault(new QName(name.getURI(), name.getLocalName()), s, "", new Element[0]); SOAPFault fault = new SOAPFault(af); addChildElement(fault);/*from ww w . j a v a 2 s .co m*/ return fault; }
From source file:org.apache.axis.message.SOAPBody.java
public javax.xml.soap.SOAPFault addFault(Name name, String s) throws SOAPException { AxisFault af = new AxisFault(new QName(name.getURI(), name.getLocalName()), s, "", new Element[0]); SOAPFault fault = new SOAPFault(af); addChildElement(fault);/*w w w .jav a 2 s . com*/ return fault; }
From source file:org.apache.axis2.jaxws.message.impl.XMLPartBase.java
public QName getOperationElement() throws WebServiceException { try {//w w w . j ava 2 s. co m if (style != Style.RPC) { return null; } switch (contentType) { case OM: return ((org.apache.axiom.soap.SOAPEnvelope) content).getBody().getFirstElement().getQName(); case SPINE: return ((XMLSpine) content).getOperationElement(); case SOAPENVELOPE: Iterator it = ((SOAPEnvelope) content).getBody().getChildElements(); while (it.hasNext()) { Node node = (Node) it.next(); if (node instanceof SOAPElement) { Name name = ((SOAPElement) node).getElementName(); return new QName(name.getURI(), name.getLocalName(), name.getPrefix()); } } } return null; } catch (SOAPException se) { throw ExceptionFactory.makeWebServiceException(se); } }
From source file:org.jbpm.bpel.integration.soap.SoapUtil.java
public static void copyAttributes(Element target, SOAPElement source) { // easy way out: no attributes to copy if (!source.hasAttributes()) return;/*from w ww .ja v a 2s . c o m*/ // traverse attributes Iterator attrNameIt = source.getAllAttributes(); while (attrNameIt.hasNext()) { Name attrName = (Name) attrNameIt.next(); String namespaceURI = attrName.getURI(); // isn't the attribute a namespace declaration? if (BpelConstants.NS_XMLNS.equals(namespaceURI)) continue; // unqualified? if (namespaceURI == null || namespaceURI.length() == 0) { String localName = attrName.getLocalName(); target.setAttribute(localName, source.getAttributeValue(attrName)); if (traceEnabled) log.trace("set attribute: " + localName); } // qualified else { Attr attr = target.getOwnerDocument().createAttributeNS(namespaceURI, attrName.getQualifiedName()); attr.setValue(source.getAttributeValue(attrName)); target.setAttributeNodeNS(attr); XmlUtil.ensureNamespaceDeclared(attr, namespaceURI, attrName.getPrefix()); if (traceEnabled) log.trace("set attribute: {" + namespaceURI + '}' + attrName.getQualifiedName()); } } }