org.ow2.petals.ws.util.AxiomHelper Maven / Gradle / Ivy
The newest version!
/**
* PETALS - PETALS Services Platform.
* Copyright (c) 2007 EBM Websourcing, http://www.ebmwebsourcing.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* -------------------------------------------------------------------------
* $Id$
* -------------------------------------------------------------------------
*/
package org.ow2.petals.ws.util;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeader;
/**
* @author Christophe HAMERLING (chamerling) - eBM WebSourcing
*
*/
public class AxiomHelper {
/**
* Create an empty {@link OMElement}
*
* @param qname
* @return
*/
public static OMElement createOMElement(QName qname) {
OMFactory factory = OMAbstractFactory.getOMFactory();
return factory.createOMElement(qname);
}
/**
*
* @param localName
* @param ns
* @param value
* @return
*/
public static OMAttribute createOMAttribute(String localName, QName ns,
String value) {
OMFactory factory = OMAbstractFactory.getOMFactory();
return factory.createOMAttribute(localName, createOMNamespace(ns),
value);
}
/**
*
* @param ns
* @return
*/
public static OMNamespace createOMNamespace(QName ns) {
OMFactory factory = OMAbstractFactory.getOMFactory();
return factory.createOMNamespace(ns.getNamespaceURI(), ns.getPrefix());
}
/**
*
* @return
*/
public static SOAPEnvelope createSOAPEnvelope() {
SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
return factory.createSOAPEnvelope();
}
/**
*
* @return
*/
public static SOAPBody createSOAPBody(SOAPEnvelope envelope) {
SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
return factory.createSOAPBody(envelope);
}
/**
*
* @return
*/
public static SOAPHeader createSOAPHeader(SOAPEnvelope envelope) {
SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
return factory.createSOAPHeader(envelope);
}
/**
*
* @return
*/
public static SOAPHeader createSOAPHeader() {
SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
return factory.createSOAPHeader();
}
/**
*
* @return
*/
public static OMDocument createEmptyDocument() {
OMFactory factory = OMAbstractFactory.getOMFactory();
return factory.createOMDocument();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy