本文整理汇总了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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}