當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。