本文整理汇总了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;
}
示例2: getFaultNode
import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
@Override
public String getFaultNode() {
SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
if (faultNode == null) {
return null;
}
return faultNode.getValue();
}
示例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");
}
};
}