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


Java SOAPElement.getLocalName方法代码示例

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


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

示例1: addChildElement

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public SOAPElement addChildElement(SOAPElement element)
    throws SOAPException {
    String localName = element.getLocalName();
    if ("Detail".equalsIgnoreCase(localName)) {
        if (hasDetail()) {
            log.severe("SAAJ0436.ver1_2.detail.exists.error");
            throw new SOAPExceptionImpl("Cannot add Detail, Detail already exists");
        }
        String uri = element.getElementQName().getNamespaceURI();
        if (!uri.equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) {
            log.severe("SAAJ0437.ver1_2.version.mismatch.error");
            throw new SOAPExceptionImpl("Cannot add Detail, Incorrect SOAP version specified for Detail element");
        }
    }
    if (element instanceof Detail1_2Impl) {
        Element importedElement = importElement(element);
        addNode(importedElement);
        return convertToSoapElement(importedElement);
    } else
        return super.addChildElement(element);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:Fault1_2Impl.java

示例2: addChildElement

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
public SOAPElement addChildElement(SOAPElement element)
    throws SOAPException {
    String localName = element.getLocalName();
    if ("Detail".equalsIgnoreCase(localName)) {
        if (hasDetail()) {
            log.severe("SAAJ0305.ver1_2.detail.exists.error");
            throw new SOAPExceptionImpl("Cannot add Detail, Detail already exists");
        }
    }
    return super.addChildElement(element);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Fault1_1Impl.java

示例3: addChildElement

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public SOAPElement addChildElement(SOAPElement element)
    throws SOAPException {
    String localName = element.getLocalName();
    if ("Detail".equalsIgnoreCase(localName)) {
        if (hasDetail()) {
            log.severe("SAAJ0305.ver1_2.detail.exists.error");
            throw new SOAPExceptionImpl("Cannot add Detail, Detail already exists");
        }
    }
    return super.addChildElement(element);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Fault1_1Impl.java

示例4: addChildElement

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public SOAPElement addChildElement(SOAPElement element)
    throws SOAPException {

    // check if Element falls in SOAP 1.1 or 1.2 namespace.
    String elementURI = element.getElementName().getURI();
    String localName = element.getLocalName();

    if ((SOAPConstants.URI_NS_SOAP_ENVELOPE).equals(elementURI)
        || (SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE).equals(elementURI)) {


        if ("Envelope".equalsIgnoreCase(localName) ||
            "Header".equalsIgnoreCase(localName) || "Body".equalsIgnoreCase(localName)) {
            log.severe("SAAJ0103.impl.cannot.add.fragements");
            throw new SOAPExceptionImpl(
                "Cannot add fragments which contain elements "
                    + "which are in the SOAP namespace");
        }

        if ("Fault".equalsIgnoreCase(localName) && !"Body".equalsIgnoreCase(this.getLocalName())) {
            log.severe("SAAJ0154.impl.adding.fault.to.nonbody");
            throw new SOAPExceptionImpl("Cannot add a SOAPFault as a child of " + this.getLocalName());
        }

        if ("Detail".equalsIgnoreCase(localName) && !"Fault".equalsIgnoreCase(this.getLocalName())) {
            log.severe("SAAJ0155.impl.adding.detail.nonfault");
            throw new SOAPExceptionImpl("Cannot add a Detail as a child of " + this.getLocalName());
        }

        if ("Fault".equalsIgnoreCase(localName)) {
           // if body is not empty throw an exception
           if (!elementURI.equals(this.getElementName().getURI())) {
               log.severe("SAAJ0158.impl.version.mismatch.fault");
               throw new SOAPExceptionImpl("SOAP Version mismatch encountered when trying to add SOAPFault to SOAPBody");
           }
           Iterator<javax.xml.soap.Node> it = this.getChildElements();
           if (it.hasNext()) {
               log.severe("SAAJ0156.impl.adding.fault.error");
               throw new SOAPExceptionImpl("Cannot add SOAPFault as a child of a non-Empty SOAPBody");
           }
        }
    }

    // preserve the encodingStyle attr as it may get lost in the import
    String encodingStyle = element.getEncodingStyle();

    final Element importedElement = importElement(element);
    addNode(importedElement);

    final SOAPElement converted = convertToSoapElement(importedElement);

    if (encodingStyle != null)
        converted.setEncodingStyle(encodingStyle);

    return converted;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:58,代码来源:ElementImpl.java


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