當前位置: 首頁>>代碼示例>>Java>>正文


Java SOAPElement.addAttribute方法代碼示例

本文整理匯總了Java中javax.xml.soap.SOAPElement.addAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPElement.addAttribute方法的具體用法?Java SOAPElement.addAttribute怎麽用?Java SOAPElement.addAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.soap.SOAPElement的用法示例。


在下文中一共展示了SOAPElement.addAttribute方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: serializeClient

import javax.xml.soap.SOAPElement; //導入方法依賴的package包/類
private void serializeClient(final SOAPHeader header, final AbstractMessage message, final SOAPEnvelope envelope) throws SOAPException {
    LOGGER.debug("Generate \"Client\" element.");
    ObjectType clientObjectType = MessageHelper.getObjectType(message.getConsumer());
    SOAPElement clientHeader = header.addChildElement(Constants.NS_XRD_ELEM_CLIENT, Constants.NS_XRD_PREFIX);
    clientHeader.addAttribute(envelope.createQName(Constants.NS_ID_ATTR_OBJECT_TYPE, Constants.NS_ID_PREFIX), clientObjectType.toString());
    SOAPElement xRoadInstance = clientHeader.addChildElement(Constants.NS_ID_ELEM_XROAD_INSTANCE, Constants.NS_ID_PREFIX);
    xRoadInstance.addTextNode(message.getConsumer().getXRoadInstance());
    SOAPElement memberClass = clientHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CLASS, Constants.NS_ID_PREFIX);
    memberClass.addTextNode(message.getConsumer().getMemberClass());
    SOAPElement memberCode = clientHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CODE, Constants.NS_ID_PREFIX);
    memberCode.addTextNode(message.getConsumer().getMemberCode());
    if (clientObjectType == ObjectType.SUBSYSTEM) {
        SOAPElement subsystem = clientHeader.addChildElement(Constants.NS_ID_ELEM_SUBSYSTEM_CODE, Constants.NS_ID_PREFIX);
        subsystem.addTextNode(message.getConsumer().getSubsystemCode());
    }
    LOGGER.debug("\"Client\" element was succesfully generated.");
}
 
開發者ID:vrk-kpa,項目名稱:xrd4j,代碼行數:18,代碼來源:AbstractHeaderSerializer.java

示例2: serializeService

import javax.xml.soap.SOAPElement; //導入方法依賴的package包/類
private void serializeService(final SOAPHeader header, final AbstractMessage message, final SOAPEnvelope envelope) throws SOAPException {
    LOGGER.debug("Generate \"Service\" element.");
    ObjectType serviceObjectType = MessageHelper.getObjectType(message.getProducer());
    SOAPElement serviceHeader = header.addChildElement(Constants.NS_XRD_ELEM_SERVICE, Constants.NS_XRD_PREFIX);
    serviceHeader.addAttribute(envelope.createQName(Constants.NS_ID_ATTR_OBJECT_TYPE, Constants.NS_ID_PREFIX), serviceObjectType.toString());
    SOAPElement xRoadInstance = serviceHeader.addChildElement(Constants.NS_ID_ELEM_XROAD_INSTANCE, Constants.NS_ID_PREFIX);
    xRoadInstance.addTextNode(message.getProducer().getXRoadInstance());
    if (serviceObjectType == ObjectType.SERVICE) {
        SOAPElement memberClass = serviceHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CLASS, Constants.NS_ID_PREFIX);
        memberClass.addTextNode(message.getProducer().getMemberClass());
        SOAPElement memberCode = serviceHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CODE, Constants.NS_ID_PREFIX);
        memberCode.addTextNode(message.getProducer().getMemberCode());
    }
    if (message.getProducer().getSubsystemCode() != null && !message.getProducer().getSubsystemCode().isEmpty()) {
        SOAPElement subsystem = serviceHeader.addChildElement(Constants.NS_ID_ELEM_SUBSYSTEM_CODE, Constants.NS_ID_PREFIX);
        subsystem.addTextNode(message.getProducer().getSubsystemCode());
    }
    SOAPElement serviceCode = serviceHeader.addChildElement(Constants.NS_ID_ELEM_SERVICE_CODE, Constants.NS_ID_PREFIX);
    serviceCode.addTextNode(message.getProducer().getServiceCode());
    if (message.getProducer().getServiceVersion() != null && !message.getProducer().getServiceVersion().isEmpty()) {
        SOAPElement serviceVersion = serviceHeader.addChildElement(Constants.NS_ID_ELEM_SERVICE_VERSION, Constants.NS_ID_PREFIX);
        serviceVersion.addTextNode(message.getProducer().getServiceVersion());
    }
    LOGGER.debug("\"Service\" element was succesfully generated.");
}
 
開發者ID:vrk-kpa,項目名稱:xrd4j,代碼行數:26,代碼來源:AbstractHeaderSerializer.java

示例3: addAttibuteToElement

import javax.xml.soap.SOAPElement; //導入方法依賴的package包/類
static void addAttibuteToElement(SOAPElement element, String prefix, String ns, String ln, String value)
        throws XMLStreamException {
    try {
        if (ns == null) {
            element.setAttributeNS("", ln, value);
        } else {
            QName name = prefix == null ? new QName(ns, ln) : new QName(ns, ln, prefix);
            element.addAttribute(name, value);
        }
    } catch (SOAPException e) {
        throw new XMLStreamException(e);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:SaajStaxWriter.java

示例4: serializeSecurityServer

import javax.xml.soap.SOAPElement; //導入方法依賴的package包/類
private void serializeSecurityServer(final SOAPHeader header, final AbstractMessage message, final SOAPEnvelope envelope) throws SOAPException {
    LOGGER.debug("Generate \"SecurityServer\" element.");
    SOAPElement securityServerHeader = header.addChildElement(Constants.NS_XRD_ELEM_SECURITY_SERVER, Constants.NS_XRD_PREFIX);
    securityServerHeader.addAttribute(envelope.createQName(Constants.NS_ID_ATTR_OBJECT_TYPE, Constants.NS_ID_PREFIX), ObjectType.SERVER.toString());
    SOAPElement xRoadInstance = securityServerHeader.addChildElement(Constants.NS_ID_ELEM_XROAD_INSTANCE, Constants.NS_ID_PREFIX);
    xRoadInstance.addTextNode(message.getSecurityServer().getXRoadInstance());
    SOAPElement memberClass = securityServerHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CLASS, Constants.NS_ID_PREFIX);
    memberClass.addTextNode(message.getSecurityServer().getMemberClass());
    SOAPElement memberCode = securityServerHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CODE, Constants.NS_ID_PREFIX);
    memberCode.addTextNode(message.getSecurityServer().getMemberCode());
    SOAPElement serverCode = securityServerHeader.addChildElement(Constants.NS_ID_ELEM_SERVER_CODE, Constants.NS_ID_PREFIX);
    serverCode.addTextNode(message.getSecurityServer().getServerCode());
    LOGGER.debug("\"SecurityServer\" element was succesfully generated.");
}
 
開發者ID:vrk-kpa,項目名稱:xrd4j,代碼行數:15,代碼來源:AbstractHeaderSerializer.java

示例5: addUpgradeHeaderElement

import javax.xml.soap.SOAPElement; //導入方法依賴的package包/類
@Override
public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSoapUris)
    throws SOAPException {
    if (supportedSoapUris == null) {
        log.severe("SAAJ0411.ver1_2.no.null.supportedURIs");
        throw new SOAPException("Argument cannot be null; iterator of supportedURIs cannot be null");
    }
    if (!supportedSoapUris.hasNext()) {
        log.severe("SAAJ0412.ver1_2.no.empty.list.of.supportedURIs");
        throw new SOAPException("List of supported URIs cannot be empty");
    }
    Name upgradeName = getUpgradeName();
    SOAPHeaderElement upgradeHeaderElement =
        (SOAPHeaderElement) addChildElement(upgradeName);
    Name supportedEnvelopeName = getSupportedEnvelopeName();
    int i = 0;
    while (supportedSoapUris.hasNext()) {
        SOAPElement subElement =
            upgradeHeaderElement.addChildElement(supportedEnvelopeName);
        String ns = "ns" + Integer.toString(i);
        subElement.addAttribute(
            NameImpl.createFromUnqualifiedName("qname"),
            ns + ":Envelope");
        subElement.addNamespaceDeclaration(
            ns, (String) supportedSoapUris.next());
        i ++;
    }
    return upgradeHeaderElement;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:30,代碼來源:HeaderImpl.java

示例6: addFaultReasonText

import javax.xml.soap.SOAPElement; //導入方法依賴的package包/類
@Override
public void addFaultReasonText(String text, java.util.Locale locale)
    throws SOAPException {

    if (locale == null) {
        log.severe("SAAJ0430.ver1_2.locale.required");
        throw new SOAPException("locale is required and must not be null");
    }

    // Fault Reason has similar semantics as faultstring
    if (this.faultStringElement == null)
        findReasonElement();
    SOAPElement reasonText;

    if (this.faultStringElement == null) {
        this.faultStringElement = addSOAPFaultElement("Reason");
        reasonText =
            this.faultStringElement.addChildElement(
                getFaultReasonTextName());
    } else {
        removeDefaultFaultString();
        reasonText = getFaultReasonTextElement(locale);
        if (reasonText != null) {
            reasonText.removeContents();
        } else {
            reasonText =
                this.faultStringElement.addChildElement(
                    getFaultReasonTextName());
        }
    }

    String xmlLang = localeToXmlLang(locale);
    reasonText.addAttribute(getXmlLangName(), xmlLang);
    reasonText.addTextNode(text);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:Fault1_2Impl.java


注:本文中的javax.xml.soap.SOAPElement.addAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。