public SOAPElement addAttribute(QName qname, String value) throws SOAPException { OMNamespace omNamespace = this.omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()); this.omTarget.addAttribute(qname.getLocalPart(), value, omNamespace); return this; }
public SOAPElement addAttribute(QName qname, String value) throws SOAPException { OMNamespace omNamespace = this.omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()); this.omTarget.addAttribute(qname.getLocalPart(), value, omNamespace); return this; }
public SOAPElement addChildElement(QName qname) throws SOAPException { if (omTarget.hasFault()) { throw new SOAPException("A SOAPFault has been already added to this SOAPBody"); } SOAPBodyElementImpl<OMElement> childEle; if (qname.getNamespaceURI() == null || "".equals(qname.getNamespaceURI())) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(null, qname.getLocalPart())); }else if(null == qname.getPrefix() || "".equals(qname.getPrefix().trim())) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(qname.getNamespaceURI(), qname.getLocalPart())); }else { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(qname.getNamespaceURI(), qname.getPrefix() + ":" + qname.getLocalPart())); } childEle.omTarget.setNamespace(omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix())); target.appendChild(childEle.target); isBodyElementAdded = true; childEle.setParentElement(this); return childEle; }
public SOAPElement addChildElement(QName qname) throws SOAPException { if (omTarget.hasFault()) { throw new SOAPException("A SOAPFault has been already added to this SOAPBody"); } SOAPBodyElementImpl<OMElement> childEle; if (qname.getNamespaceURI() == null || "".equals(qname.getNamespaceURI())) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(null, qname.getLocalPart())); }else if(null == qname.getPrefix() || "".equals(qname.getPrefix().trim())) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(qname.getNamespaceURI(), qname.getLocalPart())); }else { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(qname.getNamespaceURI(), qname.getPrefix() + ":" + qname.getLocalPart())); } childEle.omTarget.setNamespace(omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix())); target.appendChild(childEle.target); isBodyElementAdded = true; childEle.setParentElement(this); return childEle; }
public QName createQName(String localName, String prefix) throws SOAPException { if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) { return super.createQName(localName, prefix); } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) { if (this.omTarget.findNamespaceURI(prefix) == null) { throw new SOAPException("Only Namespace Qualified elements are allowed"); } else { return super.createQName(localName, prefix); } } else { throw new UnsupportedOperationException(); } }
private Iterator getChildren(Iterator childIter) { Collection childElements = new ArrayList(); while (childIter.hasNext()) { org.w3c.dom.Node domNode = (org.w3c.dom.Node)childIter.next(); org.w3c.dom.Node saajNode = toSAAJNode(domNode); if (saajNode instanceof javax.xml.soap.Text) { childElements.add(saajNode); } else if (!(saajNode instanceof SOAPBodyElement)) { // silently replace node, as per saaj 1.2 spec if (domNode instanceof Element) { if (omTarget.hasFault()) { SOAPFactory omFactory = (SOAPFactory)this.omTarget.getOMFactory(); org.apache.axiom.soap.SOAPFault fault = omFactory.createSOAPFault(omTarget); childElements.add(new SOAPFaultImpl(fault)); } else { childElements.add(new SOAPBodyElementImpl<OMElement>((OMElement)domNode)); } } } else { childElements.add(saajNode); } } return childElements.iterator(); } }
private Iterator getChildren(Iterator<? extends OMNode> childIter) { Collection childElements = new ArrayList(); while (childIter.hasNext()) { org.w3c.dom.Node domNode = (org.w3c.dom.Node)childIter.next(); org.w3c.dom.Node saajNode = toSAAJNode(domNode); if (saajNode instanceof javax.xml.soap.Text) { childElements.add(saajNode); } else if (!(saajNode instanceof SOAPBodyElement)) { // silently replace node, as per saaj 1.2 spec if (domNode instanceof Element) { if (omTarget.hasFault()) { SOAPFactory omFactory = (SOAPFactory)this.omTarget.getOMFactory(); org.apache.axiom.soap.SOAPFault fault = omFactory.createSOAPFault(omTarget); childElements.add(new SOAPFaultImpl(fault)); } else { childElements.add(new SOAPBodyElementImpl<OMElement>((OMElement)domNode)); } } } else { childElements.add(saajNode); } } return childElements.iterator(); } }
public SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException { if (omTarget.hasFault()) { throw new SOAPException("A SOAPFault has been already added to this SOAPBody"); } if (prefix == null) { prefix = ""; } SOAPBodyElementImpl<OMElement> childEle; if (uri == null || "".equals(uri)) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(null, localName)); } else if (prefix.length() == 0) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(uri, localName)); } else { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(uri, prefix + ":" + localName)); } childEle.omTarget.setNamespace(omTarget.getOMFactory().createOMNamespace(uri, prefix)); target.appendChild(childEle.target); isBodyElementAdded = true; childEle.setParentElement(this); return childEle; }
public QName createQName(String localName, String prefix) throws SOAPException { if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) { return super.createQName(localName, prefix); } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) { if (this.omTarget.findNamespaceURI(prefix) == null) { throw new SOAPException("Only Namespace Qualified elements are allowed"); } else { return super.createQName(localName, prefix); } } else { throw new UnsupportedOperationException(); } }
public SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException { if (omTarget.hasFault()) { throw new SOAPException("A SOAPFault has been already added to this SOAPBody"); } if (prefix == null) { prefix = ""; } SOAPBodyElementImpl<OMElement> childEle; if (uri == null || "".equals(uri)) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(null, localName)); } else if (prefix.length() == 0) { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(uri, localName)); } else { childEle = new SOAPBodyElementImpl<OMElement>( (OMElement)target.getOwnerDocument().createElementNS(uri, prefix + ":" + localName)); } childEle.omTarget.setNamespace(omTarget.getOMFactory().createOMNamespace(uri, prefix)); target.appendChild(childEle.target); isBodyElementAdded = true; childEle.setParentElement(this); return childEle; }
public void createRequest(SOAPBody body, Object[] args, InvocationContextImpl context) { OMFactory factory = body.getOMFactory(); OMNamespace ns = factory.createOMNamespace("urn:AdminService", "ns"); OMElement element = factory.createOMElement(requestElementName, ns, body); element.addAttribute("encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/", body.getNamespace()); int paramCount = paramHandlers.length; if (paramCount > 0) { OMNamespace xsiNS = element.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi"); for (int i=0; i<paramCount; i++) { paramHandlers[i].createOMElement(element, xsiNS, args[i], context); } } }
if (indexOfColon != -1) { localName = domEle.getTagName().substring(indexOfColon + 1); ns = omTarget.getOMFactory().createOMNamespace(domEle.getNamespaceURI(), domEle.getTagName().substring(0, indexOfColon)); } else { ns = omTarget.getOMFactory().createOMNamespace(domEle.getNamespaceURI(), prefix); } else { if (prefix != null) { ns = omTarget.getOMFactory().createOMNamespace("", prefix); } else { ns = omTarget.getOMFactory().createOMNamespace("", ""); OMElement eleImpl = this.omTarget.getOMFactory().createOMElement(localName, ns); getOwnerDocument().adoptNode((Element)eleImpl);
if (indexOfColon != -1) { localName = domEle.getTagName().substring(indexOfColon + 1); ns = omTarget.getOMFactory().createOMNamespace(domEle.getNamespaceURI(), domEle.getTagName().substring(0, indexOfColon)); } else { ns = omTarget.getOMFactory().createOMNamespace(domEle.getNamespaceURI(), prefix); } else { if (prefix != null) { ns = omTarget.getOMFactory().createOMNamespace("", prefix); } else { ns = omTarget.getOMFactory().createOMNamespace("", ""); OMElement eleImpl = this.omTarget.getOMFactory().createOMElement(localName, ns); getOwnerDocument().adoptNode((Element)eleImpl);
/** * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code> * object. * * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public SOAPFault addFault() throws SOAPException { if (isBodyElementAdded) { throw new SOAPException("A SOAPBodyElement has been already added to this SOAPBody"); } org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget); SOAPFaultImpl saajSOAPFault = new SOAPFaultImpl(fault); // set default fault code and string saajSOAPFault.setDefaults(); return saajSOAPFault; }
/** * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code> * object. * * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public SOAPFault addFault() throws SOAPException { if (isBodyElementAdded) { throw new SOAPException("A SOAPBodyElement has been already added to this SOAPBody"); } org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget); SOAPFaultImpl saajSOAPFault = new SOAPFaultImpl(fault); // set default fault code and string saajSOAPFault.setDefaults(); return saajSOAPFault; }
/** * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code> object. * The new <code>SOAPFault</code> will have a <code>faultcode</code> element that is set to the * <code>faultCode</code> parameter and a <code>faultstring</code> set to * <code>faultstring</code> and localized to <code>locale</code>. * * @param faultCode a <code>QName</code> object giving the fault code to be * @param faultString a <code>String</code> giving an explanation of the fault * @param locale a <code>Locale</code> object indicating the native language of the * <ocde>faultString</code> * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException { org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget); SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault); if (faultImpl != null) { faultImpl.setFaultCode(faultCode); if (locale != null) { faultImpl.setFaultString(faultString, locale); } else { faultImpl.setFaultString(faultString); } } return faultImpl; }
/** * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code> object. * The new <code>SOAPFault</code> will have a <code>faultcode</code> element that is set to the * <code>faultCode</code> parameter and a <code>faultstring</code> set to * <code>faultstring</code> and localized to <code>locale</code>. * * @param faultCode a <code>Name</code> object giving the fault code to be set; must be one of * the fault codes defined in the SOAP 1.1 specification and of type QName * @param faultString a <code>String</code> giving an explanation of the fault * @param locale a <code>Locale</code> object indicating the native language of the * <ocde>faultString</code> * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException { org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget); SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault); faultImpl.setFaultCode(faultCode); if (locale != null) { faultImpl.setFaultString(faultString, locale); } else { faultImpl.setFaultString(faultString); } return faultImpl; }
/** * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code> object. * The new <code>SOAPFault</code> will have a <code>faultcode</code> element that is set to the * <code>faultCode</code> parameter and a <code>faultstring</code> set to * <code>faultstring</code> and localized to <code>locale</code>. * * @param faultCode a <code>Name</code> object giving the fault code to be set; must be one of * the fault codes defined in the SOAP 1.1 specification and of type QName * @param faultString a <code>String</code> giving an explanation of the fault * @param locale a <code>Locale</code> object indicating the native language of the * <ocde>faultString</code> * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException { org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget); SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault); faultImpl.setFaultCode(faultCode); if (locale != null) { faultImpl.setFaultString(faultString, locale); } else { faultImpl.setFaultString(faultString); } return faultImpl; }
/** * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code> object. * The new <code>SOAPFault</code> will have a <code>faultcode</code> element that is set to the * <code>faultCode</code> parameter and a <code>faultstring</code> set to * <code>faultstring</code> and localized to <code>locale</code>. * * @param faultCode a <code>QName</code> object giving the fault code to be * @param faultString a <code>String</code> giving an explanation of the fault * @param locale a <code>Locale</code> object indicating the native language of the * <ocde>faultString</code> * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException { org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget); SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault); if (faultImpl != null) { faultImpl.setFaultCode(faultCode); if (locale != null) { faultImpl.setFaultString(faultString, locale); } else { faultImpl.setFaultString(faultString); } } return faultImpl; }