当前位置: 首页>>代码示例>>Java>>正文


Java Name.getPrefix方法代码示例

本文整理汇总了Java中javax.xml.soap.Name.getPrefix方法的典型用法代码示例。如果您正苦于以下问题:Java Name.getPrefix方法的具体用法?Java Name.getPrefix怎么用?Java Name.getPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.soap.Name的用法示例。


在下文中一共展示了Name.getPrefix方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOperationElement

import javax.xml.soap.Name; //导入方法依赖的package包/类
public QName getOperationElement() throws WebServiceException {
    try {
        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);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:XMLPartBase.java

示例2: createElement

import javax.xml.soap.Name; //导入方法依赖的package包/类
/**
 * Create a <code>SOAPElement</code> object initialized with the given <code>Name</code>
 * object.
 *
 * @param name a <code>Name</code> object with the XML name for the new element
 * @return the new <code>SOAPElement</code> object that was created
 * @throws javax.xml.soap.SOAPException if there is an error in creating the <code>SOAPElement</code>
 *                                      object
 */
public SOAPElement createElement(Name name) throws SOAPException {
    String localName = name.getLocalName();
    String prefix = name.getPrefix();
    String uri = name.getURI();
    OMElement omElement = null;
    if (soapVersion.equals(SOAPConstants.SOAP_1_2_PROTOCOL)) {
        omElement = DOOMAbstractFactory.getSOAP12Factory().createOMElement(localName
                , uri, prefix);
    } else {
        omElement = DOOMAbstractFactory.getSOAP11Factory().createOMElement(localName
                , uri, prefix);
    }
    DOOMAbstractFactory.getOMFactory().createOMElement(localName, uri, prefix);
    return new SOAPElementImpl((ElementImpl)omElement);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:SOAPFactoryImpl.java

示例3: addHeaderElement

import javax.xml.soap.Name; //导入方法依赖的package包/类
/**
 * Creates a new <CODE>SOAPHeaderElement</CODE> object initialized with the specified name and
 * adds it to this <CODE>SOAPHeader</CODE> object.
 *
 * @param name a <CODE>Name</CODE> object with the name of the new <CODE>SOAPHeaderElement</CODE>
 *             object
 * @return the new <CODE>SOAPHeaderElement</CODE> object that was inserted into this
 *         <CODE>SOAPHeader</CODE> object
 * @throws SOAPException if a SOAP error occurs
 */
public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
    
    if (name.getURI() == null
            || name.getURI().trim().length() == 0) {
        throw new SOAPException("SOAP1.1 and SOAP1.2 requires all HeaderElements to have " +
                "a namespace.");
    }
    String prefix = name.getPrefix() == null ? "" : name.getPrefix();
    OMNamespace ns = new NamespaceImpl(name.getURI(), prefix);

    SOAPHeaderBlock headerBlock = null;
    if (this.element.getOMFactory() instanceof SOAP11Factory) {
        headerBlock = new SOAP11HeaderBlockImpl(name.getLocalName(), ns, omSOAPHeader,
                                                (SOAPFactory)this.element.getOMFactory());
    } else {
        headerBlock = new SOAP12HeaderBlockImpl(name.getLocalName(), ns, omSOAPHeader,
                                                (SOAPFactory)this.element.getOMFactory());
    }

    SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
    element.setUserData(SAAJ_NODE, this, null);
    soapHeaderElement.element.setUserData(SAAJ_NODE, soapHeaderElement, null);
    soapHeaderElement.setParentElement(this);
    return soapHeaderElement;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:36,代码来源:SOAPHeaderImpl.java

示例4: ExtensionElementImpl

import javax.xml.soap.Name; //导入方法依赖的package包/类
/** 
 * Construct an <code>ExtensionElement</code> using the given
 * <code>SOAPEnvelope</code> and <code>SOAPElement</code>
*/
ExtensionElementImpl(SOAPEnvelope soapEnvelope, SOAPElement soapElement)
    throws SOAPException {
    this.soapEnvelope = soapEnvelope;
    this.soapElement = soapElement;
    Name name = soapElement.getElementName();
    localName = name.getLocalName();
    namespacePrefix = name.getPrefix();
    namespaceUri = name.getURI();
}
 
开发者ID:cecid,项目名称:hermes,代码行数:14,代码来源:ExtensionElementImpl.java

示例5: addAttribute

import javax.xml.soap.Name; //导入方法依赖的package包/类
/** Add an attribute of the given <code>name</code> and <code>value</code>
    to this <code>Element</code>. If the namespace is found to be non-null,
    non-empty and different from the current <code>Element</code>, the
    namespace is declared.
*/
public Element addAttribute(Name name, String value)
    throws SOAPException {
    if (name.getPrefix() != null && name.getPrefix().equals("") == false &&
        name.getPrefix().equals(soapElement.getElementName().getPrefix())
        == false) {
        List prefixList = new ArrayList();
        for (Iterator i=soapEnvelope.getNamespacePrefixes() ;
             i.hasNext() ; ) {
            String prefix = (String) i.next();
            String uri = soapEnvelope.getNamespaceURI(prefix);
            if (uri.equals(name.getURI())) {
                prefixList.add(prefix);
            }
        }
        for (int i = 0; i < prefixList.size(); i++) {
            soapEnvelope.removeNamespaceDeclaration((String) prefixList.get(i));
        }
        soapEnvelope.addNamespaceDeclaration(name.getPrefix(),
                                             name.getURI());
    }

    // new statement in hermes 2 ebms plugin coz new library used
    soapElement.removeAttribute(name);
    soapElement.addAttribute(name, value);
    return this;
}
 
开发者ID:cecid,项目名称:hermes,代码行数:32,代码来源:ExtensionElementImpl.java

示例6: convertToQName

import javax.xml.soap.Name; //导入方法依赖的package包/类
public static QName convertToQName(Name name) {
    return new QName(name.getURI(),
                     name.getLocalName(),
                     name.getPrefix());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:NameImpl.java

示例7: addChildElement

import javax.xml.soap.Name; //导入方法依赖的package包/类
public SOAPElement addChildElement(Name name) throws SOAPException {
    String prefix = name.getPrefix();
    return addChildElement(name.getLocalName(), "".equals(prefix) ? null : prefix,
                           name.getURI());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:6,代码来源:SOAPElementImpl.java

示例8: setFaultCode

import javax.xml.soap.Name; //导入方法依赖的package包/类
/**
 * Sets this SOAPFault object with the given fault code.Fault codes, which give information
 * about the fault, are defined in the SOAP 1.1 specification. A fault code is mandatory and
 * must be of type QName. This method provides a convenient way to set a fault code. For
 * example,
 * <p/>
 * SOAPEnvelope se = ...; // Create a qualified name in the SOAP namespace with a localName //
 * of Client. Note that prefix parameter is optional and is null // here which causes the
 * implementation to use an appropriate prefix. Name qname = se.createName(Client,
 * null,SOAPConstants.URI_NS_SOAP_ENVELOPE); SOAPFault fault = ...; fault.setFaultCode(qname);
 * <p/>
 * It is preferable to use this method over setFaultCode(String).
 *
 * @param faultCodeQName - a Name object giving the fault code to be set. It must be namespace
 *                       qualified.
 * @throws SOAPException - if there was an error in adding the faultcode element to the
 *                       underlying XML tree.
 */
public void setFaultCode(Name faultCodeName) throws SOAPException {
    if (faultCodeName.getURI() == null || faultCodeName.getURI().trim().length() == 0) {
        throw new SOAPException("faultCodeQName must be namespace qualified.");
    }
    QName faultCodeQName = 
        new QName(faultCodeName.getURI(), faultCodeName.getLocalName(), faultCodeName.getPrefix());
    setFaultCode(faultCodeQName);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:SOAPFaultImpl.java


注:本文中的javax.xml.soap.Name.getPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。