當前位置: 首頁>>代碼示例>>Java>>正文


Java SOAPFault.getFaultCodeAsName方法代碼示例

本文整理匯總了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());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:21,代碼來源:SOAPFaultTest.java

示例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());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:22,代碼來源:SOAPFaultTest.java

示例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());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:21,代碼來源:SOAPFaultTest.java

示例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());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:20,代碼來源:SOAPFaultTest.java


注:本文中的javax.xml.soap.SOAPFault.getFaultCodeAsName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。