本文整理汇总了Java中javax.xml.soap.Detail.getDetailEntries方法的典型用法代码示例。如果您正苦于以下问题:Java Detail.getDetailEntries方法的具体用法?Java Detail.getDetailEntries怎么用?Java Detail.getDetailEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.soap.Detail
的用法示例。
在下文中一共展示了Detail.getDetailEntries方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _testFaults2
import javax.xml.soap.Detail; //导入方法依赖的package包/类
public void _testFaults2() throws Exception {
SOAPEnvelope envelope = getSOAPEnvelope();
SOAPBody body = envelope.getBody();
SOAPFault fault = body.addFault();
assertTrue(body.getFault() != null);
Detail d1 = fault.addDetail();
Name name = envelope.createName("GetLastTradePrice", "WOMBAT",
"http://www.wombat.org/trader");
d1.addDetailEntry(name);
Detail d2 = fault.getDetail();
assertTrue(d2 != null);
Iterator i = d2.getDetailEntries();
assertTrue(getIteratorCount(i) == 1);
i = d2.getDetailEntries();
while (i.hasNext()) {
DetailEntry de = (DetailEntry)i.next();
assertEquals(de.getElementName(), name);
}
}
示例2: detailChildrenIterator
import javax.xml.soap.Detail; //导入方法依赖的package包/类
/**
* It can either e within an extra tag, or directly.
*/
private Iterator detailChildrenIterator(Detail detail) {
/*
sb.append("<ns2:AccessDeniedWebServiceException xmlns:ns2=\"http://exceptionthrower.system.services.v4_0.soap.server.nameapi.org/\">");
sb.append("<blame>CLIENT</blame>");
sb.append("<errorCode>2101</errorCode>");
sb.append("<faultCause>AccessDenied</faultCause>");
*/
DetailEntry firstDetailEntry = getFirstDetailEntry(detail);
if (firstDetailEntry!=null) {
String localName = firstDetailEntry.getElementName().getLocalName();
if (localName.endsWith("Exception")) {
//got a subtag
return firstDetailEntry.getChildElements();
}
}
return detail.getDetailEntries();
}
示例3: getFirstDetailEntryName
import javax.xml.soap.Detail; //导入方法依赖的package包/类
private static @Nullable QName getFirstDetailEntryName(@Nullable Detail detail) {
if (detail != null) {
Iterator<DetailEntry> it = detail.getDetailEntries();
if (it.hasNext()) {
DetailEntry entry = it.next();
return getFirstDetailEntryName(entry);
}
}
return null;
}
示例4: getFirstDetailEntry
import javax.xml.soap.Detail; //导入方法依赖的package包/类
@Nullable
private DetailEntry getFirstDetailEntry(@NotNull Detail detail) {
Iterator detailEntries = detail.getDetailEntries();
while (detailEntries.hasNext()) {
Object next = detailEntries.next();
if (next instanceof DetailEntry) {
return (DetailEntry)next;
}
}
return null;
}
示例5: testFaults
import javax.xml.soap.Detail; //导入方法依赖的package包/类
@Validated @Test
public void testFaults() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPFactory soapFactory = SOAPFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPBody body = message.getSOAPBody();
SOAPFault fault = body.addFault();
Name faultName =
soapFactory.createName("Client", "",
SOAPConstants.URI_NS_SOAP_ENVELOPE);
fault.setFaultCode(faultName);
fault.setFaultString("Message does not have necessary info");
fault.setFaultActor("http://gizmos.com/order");
Detail detail = fault.addDetail();
Name entryName =
soapFactory.createName("order", "PO",
"http://gizmos.com/orders/");
DetailEntry entry = detail.addDetailEntry(entryName);
entry.addTextNode("Quantity element does not have a value");
Name entryName2 =
soapFactory.createName("confirmation", "PO",
"http://gizmos.com/confirm");
DetailEntry entry2 = detail.addDetailEntry(entryName2);
entry2.addTextNode("Incomplete address: " + "no zip code");
message.saveChanges();
//message.writeTo(System.out);
// Now retrieve the SOAPFault object and
// its contents, after checking to see that
// there is one
if (body.hasFault()) {
SOAPFault newFault = body.getFault();
// Get the qualified name of the fault code
assertNotNull(newFault.getFaultCodeAsName());
assertNotNull(newFault.getFaultString());
assertNotNull(newFault.getFaultActor());
Detail newDetail = newFault.getDetail();
if (newDetail != null) {
Iterator entries = newDetail.getDetailEntries();
while (entries.hasNext()) {
DetailEntry newEntry = (DetailEntry)entries.next();
String value = newEntry.getValue();
assertNotNull(value);
}
}
}
}