本文整理匯總了Java中javax.xml.soap.SOAPFault.getFaultCodeAsName方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPFault.getFaultCodeAsName方法的具體用法?Java SOAPFault.getFaultCodeAsName怎麽用?Java SOAPFault.getFaultCodeAsName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.soap.SOAPFault
的用法示例。
在下文中一共展示了SOAPFault.getFaultCodeAsName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSetGetFaultCodeAsName1
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Validated @Test
public void testSetGetFaultCodeAsName1() throws Exception {
SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPFault sf = fac.createFault();
Name name = fac.createName("myfault", "flt", "http://example.com");
sf.setFaultCode(name);
Name name2 = sf.getFaultCodeAsName();
assertNotNull(name2);
assertEquals(name.getLocalName(), name2.getLocalName());
assertEquals(name.getPrefix(), name2.getPrefix());
assertEquals(name.getURI(), name2.getURI());
QName name3 = sf.getFaultCodeAsQName();
assertNotNull(name3);
assertEquals(name.getLocalName(), name3.getLocalPart());
assertEquals(name.getPrefix(), name3.getPrefix());
assertEquals(name.getURI(), name3.getNamespaceURI());
}
示例2: testSetGetFaultCodeAsName2
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Validated @Test
public void testSetGetFaultCodeAsName2() throws Exception {
QName qname = SOAPConstants.SOAP_SENDER_FAULT;
SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
Name name = fac.createName(qname.getLocalPart(),
qname.getPrefix(), qname.getNamespaceURI());
SOAPFault sf = fac.createFault();
sf.setFaultCode(name);
Name name2 = sf.getFaultCodeAsName();
assertNotNull(name2);
assertEquals(name.getLocalName(), name2.getLocalName());
assertEquals(name.getPrefix(), name2.getPrefix());
assertEquals(name.getURI(), name2.getURI());
QName name3 = sf.getFaultCodeAsQName();
assertNotNull(name3);
assertEquals(name.getLocalName(), name3.getLocalPart());
assertEquals(name.getPrefix(), name3.getPrefix());
assertEquals(name.getURI(), name3.getNamespaceURI());
}
示例3: testSetGetFaultCodeAsQName1
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Validated @Test
public void testSetGetFaultCodeAsQName1() throws Exception {
SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPFault sf = fac.createFault();
QName name = new QName("http://example.com", "myfault", "flt");
sf.setFaultCode(name);
QName name2 = sf.getFaultCodeAsQName();
assertNotNull(name2);
assertEquals(name.getLocalPart(), name2.getLocalPart());
assertEquals(name.getPrefix(), name2.getPrefix());
assertEquals(name.getNamespaceURI(), name2.getNamespaceURI());
Name name3 = sf.getFaultCodeAsName();
assertNotNull(name3);
assertEquals(name.getLocalPart(), name3.getLocalName());
assertEquals(name.getPrefix(), name3.getPrefix());
assertEquals(name.getNamespaceURI(), name3.getURI());
}
示例4: testSetGetFaultCodeAsQName2
import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Validated @Test
public void testSetGetFaultCodeAsQName2() throws Exception {
QName name = SOAPConstants.SOAP_SENDER_FAULT;
SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPFault sf = fac.createFault();
sf.setFaultCode(name);
QName name2 = sf.getFaultCodeAsQName();
assertNotNull(name2);
assertEquals(name.getLocalPart(), name2.getLocalPart());
assertEquals(name.getPrefix(), name2.getPrefix());
assertEquals(name.getNamespaceURI(), name2.getNamespaceURI());
Name name3 = sf.getFaultCodeAsName();
assertNotNull(name3);
assertEquals(name.getLocalPart(), name3.getLocalName());
assertEquals(name.getPrefix(), name3.getPrefix());
assertEquals(name.getNamespaceURI(), name3.getURI());
}