本文整理匯總了Java中javax.xml.soap.SOAPFault.getDetail方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPFault.getDetail方法的具體用法?Java SOAPFault.getDetail怎麽用?Java SOAPFault.getDetail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.soap.SOAPFault
的用法示例。
在下文中一共展示了SOAPFault.getDetail方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SOAP12Fault
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
SOAP12Fault(SOAPFault fault) {
code = new CodeType(fault.getFaultCodeAsQName());
try {
fillFaultSubCodes(fault);
} catch (SOAPException e) {
throw new WebServiceException(e);
}
reason = new ReasonType(fault.getFaultString());
role = fault.getFaultRole();
node = fault.getFaultNode();
if (fault.getDetail() != null) {
detail = new DetailType();
Iterator iter = fault.getDetail().getDetailEntries();
while(iter.hasNext()){
Element fd = (Element)iter.next();
detail.getDetails().add(fd);
}
}
}
示例2: MapFault
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
private static List<Result> MapFault(SOAPFault result) {
List<Result> r = new ArrayList<Result>();
if (result == null) {
return r;
}
if (result.getDetail() != null) {
while (result.getDetail().getDetailEntries().hasNext()) {
Object next = result.getDetail().getDetailEntries().next();
if (next instanceof DispositionReport) {
DispositionReport z = (DispositionReport) next;
r.addAll(MapResult(z.getFaultInfo().getResult()));
}
logger.warn("unable to parse fault detail, type:" + next.getClass().getCanonicalName() + " " + next.toString());
}
}
return r;
}
示例3: testDetails
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Test
public void testDetails() throws Exception {
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage smsg =
mf.createMessage(new MimeHeaders(), new ByteArrayInputStream(xmlString.getBytes()));
SOAPBody body = smsg.getSOAPBody();
//smsg.writeTo(System.out);
SOAPFault fault = body.getFault();
fault.addDetail();
javax.xml.soap.Detail d = fault.getDetail();
Iterator i = d.getDetailEntries();
while (i.hasNext()) {
DetailEntry entry = (DetailEntry)i.next();
String name = entry.getElementName().getLocalName();
if ("tickerSymbol".equals(name)) {
assertEquals("the value of the tickerSymbol element didn't match",
"MACR", entry.getValue());
} else if ("exceptionName".equals(name)) {
assertEquals("the value of the exceptionName element didn't match",
"test.wsdl.faults.InvalidTickerFaultMessage", entry.getValue());
} else {
assertTrue("Expecting details element name of 'tickerSymbol' or " +
"'expceptionName' - I found :" + name, false);
}
}
}
示例4: _testFaults2
import javax.xml.soap.SOAPFault; //導入方法依賴的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);
}
}
示例5: SOAP11Fault
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
SOAP11Fault(SOAPFault fault) {
this.faultcode = fault.getFaultCodeAsQName();
this.faultstring = fault.getFaultString();
this.faultactor = fault.getFaultActor();
if (fault.getDetail() != null) {
detail = new DetailType();
Iterator iter = fault.getDetail().getDetailEntries();
while(iter.hasNext()){
Element fd = (Element)iter.next();
detail.getDetails().add(fd);
}
}
}
示例6: translate
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@NotNull @Override
public Exception translate(@NotNull Throwable t) throws Exception {
SOAPFaultException e = (SOAPFaultException) t;
ServiceException exToThrow = null;
try {
SOAPFault fault = e.getFault();
if (fault != null) {
Detail detail = fault.getDetail();
if (detail != null) {
SoapFaultInfo faultInfo = extractFaultInfo(detail);
exToThrow = converter.makeException(faultInfo);
}
}
} catch (RuntimeException exWhileTryingToMakeEx) {
//this ex should never hide the original one.
log.error("Failed translating exception: "+exWhileTryingToMakeEx.getMessage(), exWhileTryingToMakeEx);
throw e; //keep the original, or throw a general one. that's the best we can do here.
}
if (exToThrow!=null) {
//good.
throw exToThrow;
} else {
//arriving here means we could not translate it. this should not happen.
//let's keep what we had and rethrow.
log.error("Failed translating exception!");
throw e;
}
}
示例7: testFaults
import javax.xml.soap.SOAPFault; //導入方法依賴的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);
}
}
}
}