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


Java AxisFault.getFaultDetailElement方法代碼示例

本文整理匯總了Java中org.apache.axis2.AxisFault.getFaultDetailElement方法的典型用法代碼示例。如果您正苦於以下問題:Java AxisFault.getFaultDetailElement方法的具體用法?Java AxisFault.getFaultDetailElement怎麽用?Java AxisFault.getFaultDetailElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.axis2.AxisFault的用法示例。


在下文中一共展示了AxisFault.getFaultDetailElement方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSOAP11FaultDetailAsElement

import org.apache.axis2.AxisFault; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.1 fault details as Element")
public void testSOAP11FaultDetailAsElement() throws AxisFault {

    try {
        axis2Client.sendSimpleStockQuoteRequest(
                getMainSequenceURL(),
                null,
                "WSO2");
        fail("This query must throw an exception.");
    } catch (AxisFault expected) {
        log.info("Fault Message : " + expected.getMessage());
        assertEquals(expected.getReason(), "Soap11FaultDetailAsElementTestCase", "Fault Reason Mismatched");
        assertEquals(expected.getFaultCode().getPrefix(), "soap11Env", "Fault code prefix mismatched");
        SOAPFaultDetail detailElm = expected.getFaultDetailElement();
        OMElement statusOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "StatusCode", "axis2ns1"));
        assertNotNull(statusOME, "Fault detail element StatusCode null");
        assertEquals(statusOME.getText(), "1000", "Fault detail StatusCode mismatched");

        OMElement messageOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "message", "axis2ns1"));
        assertNotNull(messageOME, "Fault detail element message null");
        assertEquals(messageOME.getText(), "fault details by automation", "Fault detail message mismatched");

    }

}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:26,代碼來源:Soap11FaultDetailAsElementTestCase.java

示例2: testSOAP12FaultDetailAsElement

import org.apache.axis2.AxisFault; //導入方法依賴的package包/類
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.2 fault details as Element")
public void testSOAP12FaultDetailAsElement() throws AxisFault {
    try {
        axis2Client.sendSimpleStockQuoteSoap12(
                getMainSequenceURL(),
                "http://localhost:9010/services/NonExistingService",
                "WSO2");
        fail("This query must throw an exception.");
    } catch (AxisFault expected) {
        log.info("Fault Message : " + expected.getMessage());
        assertEquals(expected.getReason(), "Soap12FaultDetailAsElementTestCase", "Fault Reason Mismatched");
        assertEquals(expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched");
        assertEquals(expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched");
        SOAPFaultDetail detailElm = expected.getFaultDetailElement();
        OMElement statusOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "StatusCode", "axis2ns1"));
        assertNotNull(statusOME, "Fault detail element StatusCode null");
        assertEquals(statusOME.getText(), "1000", "Fault detail StatusCode mismatched");

        OMElement messageOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "message", "axis2ns1"));
        assertNotNull(messageOME, "Fault detail element message null");
        assertEquals(messageOME.getText(), "fault details by automation", "Fault detail message mismatched");

    }

}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:26,代碼來源:Soap12FaultDetailAsElementTestCase.java

示例3: testGenerateFaults1

import org.apache.axis2.AxisFault; //導入方法依賴的package包/類
@Test(groups = "wso2.esb",
      description = "Using script mediator to generate faults. Test 1.")
public void testGenerateFaults1() throws XMLStreamException {
    try {

        axis2Client.sendSimpleStockQuoteRequest(
                getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null,
                "MSFT");

        Assert.fail("Request must throw a AxisFault");

    } catch (AxisFault e) {

        SOAPFaultDetail faultDetail = e.getFaultDetailElement();
        assertNotNull(faultDetail, "Fault response message null");

        OMElement firstElemnt = faultDetail.getFirstElement();
        OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode"));
        OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText"));
        assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode",
                     "Fault detail element");
        assertEquals(errorCode.getText(), "8719",
                     "Fault detail element");
        assertEquals(errorText.getText(), "Issue has",
                     "Fault detail element");

    }
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:29,代碼來源:ScriptIntegrationToGenerateFaultTestCase.java

示例4: testGenerateFaults2

import org.apache.axis2.AxisFault; //導入方法依賴的package包/類
@Test(groups = "wso2.esb",
      description = "Using script mediator to generate faults.Test 2. "
)
public void testGenerateFaults2() throws XMLStreamException {
    try {

        axis2Client.sendSimpleStockQuoteRequest(
                getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null,
                "SUN");
        Assert.fail("Request must throw a AxisFault");

    } catch (AxisFault e) {

        SOAPFaultDetail faultDetail = e.getFaultDetailElement();
        assertNotNull(faultDetail, "Fault response message null");
        OMElement firstElemnt = faultDetail.getFirstElement();
        OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode"));
        OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText"));
        assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode",
                     "Fault detail element");
        assertEquals(errorCode.getText(), "8719",
                     "Fault detail element");
        assertEquals(errorText.getText(), "Issue has",
                     "Fault detail element");


    }
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:29,代碼來源:ScriptIntegrationToGenerateFaultTestCase.java


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