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


Java SOAPElement.addTextNode方法代码示例

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


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

示例1: appendFaultSubcode

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public void appendFaultSubcode(QName subcode) throws SOAPException {
    if (subcode == null) {
        return;
    }
    if (subcode.getNamespaceURI() == null ||
        "".equals(subcode.getNamespaceURI())) {

        log.severe("SAAJ0432.ver1_2.subcode.not.ns.qualified");
        throw new SOAPExceptionImpl("A Subcode must be namespace-qualified");
    }
    if (innermostSubCodeElement == null) {
        if (faultCodeElement == null)
            findFaultCodeElement();
        innermostSubCodeElement = faultCodeElement;
    }
    String prefix = null;
    if (subcode.getPrefix() == null || "".equals(subcode.getPrefix())) {
        prefix =
            ((ElementImpl) innermostSubCodeElement).getNamespacePrefix(
                subcode.getNamespaceURI());
    } else
        prefix = subcode.getPrefix();
    if (prefix == null || "".equals(prefix)) {
        prefix = "ns1";
    }
    innermostSubCodeElement =
        innermostSubCodeElement.addChildElement(subcodeName);
    SOAPElement subcodeValueElement =
        innermostSubCodeElement.addChildElement(valueName);
    ((ElementImpl) subcodeValueElement).ensureNamespaceIsDeclared(
        prefix,
        subcode.getNamespaceURI());
    subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:Fault1_2Impl.java

示例2: 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

示例3: serializeResponse

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
/**
 * Serializes the response data.
 *
 * @param response ServiceResponse holding the application specific
 * response object
 * @param soapResponse SOAPMessage's response object where the response
 * element is added
 * @param envelope SOAPMessage's SOAPEnvelope object
 */
public void serializeResponse(ServiceResponse response, SOAPElement soapResponse, SOAPEnvelope envelope) throws SOAPException {
    // Add "data" element
    SOAPElement data = soapResponse.addChildElement(envelope.createName("data"));
    // Put response data inside the "data" element
    data.addTextNode((String) response.getResponseData());
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:17,代码来源:ExampleAdapter.java

示例4: setFaultNode

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public void setFaultNode(String uri) throws SOAPException {
    SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
    if (faultNode != null) {
        faultNode.detachNode();
    }
    faultNode = createSOAPFaultElement(getFaultNodeName());
    faultNode = faultNode.addTextNode(uri);
    if (getFaultRole() != null) {
        insertBefore(faultNode, this.faultActorElement);
        return;
    }
    if (hasDetail()) {
        insertBefore(faultNode, this.detail);
        return;
    }
    addNode(faultNode);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:Fault1_2Impl.java

示例5: 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

示例6: addElement

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
/**
 * @author wasiq.bhamla
 * @since Aug 26, 2017 4:11:33 PM
 * @param parent
 * @param element
 * @throws SOAPException
 */
private <T extends SOAPElement> void addElement (final T parent, final RequestElement element)
		throws SOAPException {
	final List <RequestElement> elementList = element.childs ();
	for (int i = 0; i < elementList.size (); i++) {
		final T currentParent = parent;
		final RequestElement currentElement = elementList.get (i);
		SOAPElement child = null;

		if (currentElement.display ()) {
			if (currentElement.prefix () != null) {
				child = currentParent.addChildElement (currentElement.name (), currentElement.prefix ());
			}
			else {
				child = currentParent.addChildElement (currentElement.name ());
			}

			addNamespaces (child, currentElement);
			addAttributes (child, currentElement);

			final Object value = currentElement.value ();
			if (null != value) {
				child.addTextNode (value.toString ());
			}
			addElement (child, currentElement);
		}
	}
}
 
开发者ID:WasiqB,项目名称:coteafs-services,代码行数:35,代码来源:SoapRequestParser.java

示例7: serializeSOAPFaultDetail

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
protected void serializeSOAPFaultDetail(ErrorMessage errorMessage, SOAPElement faultDetail) throws SOAPException {
    for (String key : ((Map<String, String>) errorMessage.getDetail()).keySet()) {
        SOAPElement element = faultDetail.addChildElement(key);
        element.addTextNode(((Map<String, String>) errorMessage.getDetail()).get(key));
    }
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:8,代码来源:ServiceResponseSerializerTest.java

示例8: 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

示例9: process

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
public void process(SOAPEnvelope req, SOAPEnvelope resp) throws javax.xml.soap.SOAPException {
	SOAPBody body = resp.getBody();
	Name ns0 =  resp.createName("TestNS0", "ns0", "http://example.com");
	Name ns1 =  resp.createName("TestNS1", "ns1", "http://example.com");
	SOAPElement bodyElmnt = body.addBodyElement(ns0);
	SOAPElement el = bodyElmnt.addChildElement(ns1);
	el.addTextNode("TEST RESPONSE");
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:MessageService.java

示例10: getStockQuote

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
public String getStockQuote(String tickerSymbol) throws Exception {
    SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection con = scFactory.createConnection();

    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage message = factory.createMessage();

    SOAPPart soapPart = message.getSOAPPart();
    SOAPEnvelope envelope = soapPart.getEnvelope();

    SOAPHeader header = envelope.getHeader();
    SOAPBody body = envelope.getBody();

    header.detachNode();

    Name bodyName = envelope.createName("getQuote", "n", "urn:xmethods-delayed-quotes");
    SOAPBodyElement gltp = body.addBodyElement(bodyName);

    Name name = envelope.createName("symbol");
    SOAPElement symbol = gltp.addChildElement(name);
    symbol.addTextNode(tickerSymbol);

    URLEndpoint endpoint = new URLEndpoint("http://64.124.140.30/soap");
    SOAPMessage response = con.call(message, endpoint);
    con.close();

    SOAPPart sp = response.getSOAPPart();
    SOAPEnvelope se = sp.getEnvelope();
    SOAPBody sb = se.getBody();
    Iterator it = sb.getChildElements();
    while (it.hasNext()) {
        SOAPBodyElement bodyElement = (SOAPBodyElement) it.next();
        Iterator it2 = bodyElement.getChildElements();
        while (it2.hasNext()) {
            SOAPElement element2 = (SOAPElement) it2.next();
            return element2.getValue();
        }
    }
    return null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:DelayedStockQuote.java

示例11: 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

示例12: serializeRequest

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
protected void serializeRequest(ServiceRequest serviceRequest, SOAPElement soapRequest, SOAPEnvelope envelope) throws SOAPException {
    SOAPElement data = soapRequest.addChildElement(envelope.createName("data"));
    data.addTextNode((String) serviceRequest.getRequestData());
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:5,代码来源:SOAPClientTest.java

示例13: serializeRequest

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
protected void serializeRequest(ServiceRequest request, SOAPElement soapRequest, SOAPEnvelope envelope) throws SOAPException {
    SOAPElement data = soapRequest.addChildElement(envelope.createName("data"));
    data.addTextNode((String) request.getRequestData());
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:5,代码来源:ServiceRequestSerializerTest.java

示例14: serializeResponse

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
public void serializeResponse(ServiceResponse response, SOAPElement soapResponse, SOAPEnvelope envelope) throws SOAPException {
    for (String key : ((Map<String, String>) response.getResponseData()).keySet()) {
        SOAPElement element = soapResponse.addChildElement(key);
        element.addTextNode(((Map<String, String>) response.getResponseData()).get(key));
    }
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:7,代码来源:ServiceResponseSerializerTest.java

示例15: serializeHeader

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
/**
 * Adds X-Road version 6 SOAP headers to the given SOAP envelope. The given
 * message holds the actual data used in the headers.
 *
 * @param message request or response message that holds the data for the
 * headers
 * @param envelope SOAP envelope where SOAP headers are added
 * @throws SOAPException if there's a SOAP error
 */
protected final void serializeHeader(final AbstractMessage message, final SOAPEnvelope envelope) throws SOAPException {
    LOGGER.debug("Generate SOAP header.");
    if (message.hasError() && message.getErrorMessage().getErrorMessageType() == ErrorMessageType.STANDARD_SOAP_ERROR_MESSAGE) {
        LOGGER.warn("Standard SOAP error detected. SOAP header is skipped.");
        return;
    }
    envelope.addNamespaceDeclaration(Constants.NS_ID_PREFIX, Constants.NS_ID_URL);
    envelope.addNamespaceDeclaration(Constants.NS_XRD_PREFIX, Constants.NS_XRD_URL);

    // Header - Start
    SOAPHeader header = envelope.getHeader();
    // Client - Start
    this.serializeClient(header, message, envelope);
    // Client - End
    // Service - Start
    this.serializeService(header, message, envelope);
    // Service - End
    // Security Server - Start
    if (message.getSecurityServer() != null) {
        this.serializeSecurityServer(header, message, envelope);
    }
    // SecurityServer - End
    if (message.getUserId() != null && !message.getUserId().isEmpty()) {
        LOGGER.debug("Generate \"{}\" element.", Constants.NS_XRD_ELEM_USER_ID);
        SOAPElement userId = header.addChildElement(Constants.NS_XRD_ELEM_USER_ID, Constants.NS_XRD_PREFIX);
        userId.addTextNode(message.getUserId());
        LOGGER.debug("\"{}\" element was succesfully generated.", Constants.NS_XRD_ELEM_USER_ID);
    }
    LOGGER.debug("Generate \"{}\" element.", Constants.NS_XRD_ELEM_ID);
    SOAPElement id = header.addChildElement(Constants.NS_XRD_ELEM_ID, Constants.NS_XRD_PREFIX);
    id.addTextNode(message.getId());
    LOGGER.debug("\"{}\" element was succesfully generated.", Constants.NS_XRD_ELEM_ID);
    if (message.getIssue() != null && !message.getIssue().isEmpty()) {
        LOGGER.debug("Generate \"{}\" element.", Constants.NS_XRD_ELEM_ISSUE);
        SOAPElement issue = header.addChildElement(Constants.NS_XRD_ELEM_ISSUE, Constants.NS_XRD_PREFIX);
        issue.addTextNode(message.getIssue());
        LOGGER.debug("\"{}\" element was succesfully generated.", Constants.NS_XRD_ELEM_ISSUE);
    }
    LOGGER.debug("Generate \"{}\" element.", Constants.NS_XRD_ELEM_PROTOCOL_VERSION);
    SOAPElement protocolVersion = header.addChildElement(Constants.NS_XRD_ELEM_PROTOCOL_VERSION, Constants.NS_XRD_PREFIX);
    protocolVersion.addTextNode(message.getProtocolVersion());
    LOGGER.debug("\"{}\" element was succesfully generated.", Constants.NS_XRD_ELEM_PROTOCOL_VERSION);
    // Header - End
    LOGGER.debug("SOAP header was generated succesfully.");
}
 
开发者ID:vrk-kpa,项目名称:xrd4j,代码行数:55,代码来源:AbstractHeaderSerializer.java


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