本文整理匯總了Java中javax.xml.soap.SOAPFault.getFaultNode方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPFault.getFaultNode方法的具體用法?Java SOAPFault.getFaultNode怎麽用?Java SOAPFault.getFaultNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.soap.SOAPFault
的用法示例。
在下文中一共展示了SOAPFault.getFaultNode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testCustomRoleNodeFault12
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
/**
* Tests that Role and Node
* are set properly on SOAP 1.2 Fault.
* @throws Exception
*/
public void testCustomRoleNodeFault12() throws Exception {
MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage sm = mf.createMessage();
SOAPBody body = sm.getSOAPBody();
SOAPFault fault = body.addFault();
fault.setFaultRole("TestRole");
fault.setFaultNode("http://XMLFaultTest/testCustomRoleNodeFault/");
XMLFault xmlFault = XMLFaultUtils.createXMLFault(fault);
SOAPFault retFault = XMLFaultUtils.createSAAJFault(xmlFault, body);
assertTrue(retFault != null);
String role = retFault.getFaultRole();
assertTrue(role != null);
assertTrue(role.equals("TestRole"));
// Actor and role should be the same
String actor = retFault.getFaultActor();
assertTrue(actor != null);
assertTrue(actor.equals("TestRole"));
String node = retFault.getFaultNode();
assertTrue(node != null);
assertTrue(node.equals("http://XMLFaultTest/testCustomRoleNodeFault/"));
}