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


Java SOAPElement.getValue方法代码示例

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


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

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

示例2: getFaultNode

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public String getFaultNode() {
    SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
    if (faultNode == null) {
        return null;
    }
    return faultNode.getValue();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Fault1_2Impl.java

示例3: getFaultSubcodes

import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public Iterator<QName> getFaultSubcodes() {
    if (this.faultCodeElement == null)
        findFaultCodeElement();
    final List<QName> subcodeList = new ArrayList<>();
    SOAPElement currentCodeElement = this.faultCodeElement;
    Iterator subcodeElements =
        currentCodeElement.getChildElements(subcodeName);
    while (subcodeElements.hasNext()) {
        currentCodeElement = (ElementImpl) subcodeElements.next();
        Iterator valueElements =
            currentCodeElement.getChildElements(valueName);
        SOAPElement valueElement = (SOAPElement) valueElements.next();
        String code = valueElement.getValue();
        subcodeList.add(convertCodeToQName(code, valueElement));
        subcodeElements = currentCodeElement.getChildElements(subcodeName);
    }
    //return subcodeList.iterator();
    return new Iterator<QName>() {
        Iterator<QName> subCodeIter = subcodeList.iterator();

        @Override
        public boolean hasNext() {
            return subCodeIter.hasNext();
        }

        @Override
        public QName next() {
            return subCodeIter.next();
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException(
                "Method remove() not supported on SubCodes Iterator");
        }
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:Fault1_2Impl.java


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