本文整理汇总了Java中org.apache.axis2.AxisFault类的典型用法代码示例。如果您正苦于以下问题:Java AxisFault类的具体用法?Java AxisFault怎么用?Java AxisFault使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AxisFault类属于org.apache.axis2包,在下文中一共展示了AxisFault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initStub
import org.apache.axis2.AxisFault; //导入依赖的package包/类
private void initStub(Stub stub) throws AxisFault
{
if( stub != null )
{
final ServiceClient client = stub._getServiceClient();
final Options options = client.getOptions();
options.setProperty(WSHandlerConstants.PW_CALLBACK_REF, this);
options.setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, ofc.getProperty());
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");
options.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_11);
URI uri = URI.create(bbUrl);
if( uri.getScheme().toLowerCase().startsWith("https") )
{
Protocol myhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, myhttps);
}
client.engageModule("rampart-1.5.1");
}
}
示例2: resolveUsertoken
import org.apache.axis2.AxisFault; //导入依赖的package包/类
public String resolveUsertoken(String usertoken, String saasId)
throws ServletException, RemoteException {
SessionServiceStub stub = new SessionServiceStub(getEndPoint(false));
setBasicAuth(stub);
SessionServiceStub.ResolveUserTokenE rut = new SessionServiceStub.ResolveUserTokenE();
SessionServiceStub.ResolveUserToken param = new SessionServiceStub.ResolveUserToken();
param.setSessionId(getSessionId(saasId));
param.setUserToken(usertoken);
param.setSubscriptionKey(getSubscriptionKey(saasId));
rut.setResolveUserToken(param);
try {
ResolveUserTokenResponseE response = stub.resolveUserToken(rut);
return response.getResolveUserTokenResponse().get_return();
} catch (AxisFault e) {
if (port < 8185 && searchPort
&& e.getDetail() instanceof ConnectException) {
// try again with another port
port++;
return resolveUsertoken(usertoken, saasId);
}
throw new ServletException(e);
}
}
示例3: logoutUser
import org.apache.axis2.AxisFault; //导入依赖的package包/类
public String logoutUser(String saasId) throws ServletException,
RemoteException {
SessionServiceStub stub = new SessionServiceStub(getEndPoint(false));
setBasicAuth(stub);
SessionServiceStub.DeleteServiceSessionE dss = new SessionServiceStub.DeleteServiceSessionE();
SessionServiceStub.DeleteServiceSession param = new SessionServiceStub.DeleteServiceSession();
param.setSessionId(getSessionId(saasId));
param.setSubscriptionKey(getSubscriptionKey(saasId));
dss.setDeleteServiceSession(param);
try {
DeleteServiceSessionResponseE response = stub
.deleteServiceSession(dss);
return response.getDeleteServiceSessionResponse().get_return();
} catch (AxisFault e) {
if (port < 8185 && searchPort
&& e.getDetail() instanceof ConnectException) {
// try again with another port
port++;
return logoutUser(saasId);
}
throw new ServletException(e);
}
}
示例4: testSOAP12FaultFromOutSequence
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.2 fault messages from outMediator sequence")
public void testSOAP12FaultFromOutSequence() throws AxisFault {
try {
axis2Client.sendSimpleStockQuoteSoap12(
getMainSequenceURL(),
null,
"WSO2");
fail("This query must throw an Axis Fault.");
} catch (AxisFault expected) {
log.info("Fault Message : " + expected.getMessage());
assertEquals(expected.getReason(), "Custom ERROR Message - Soap12FaultOutSequenceTestCase", "Custom ERROR Message mismatched");
assertEquals(expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched");
assertEquals(expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched");
assertEquals(expected.getFaultRoleElement().getRoleValue(), "automation", "Role mismatched");
assertEquals(expected.getFaultNodeElement().getNodeValue(), "automation-node", "Fault node mismatched");
assertEquals(expected.getFaultDetailElement().getText(), "fault details by automation", "Fault detail mismatched");
}
}
示例5: callMediatorInNestedFilterSwitchTestCase
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.esb"})
public void callMediatorInNestedFilterSwitchTestCase() throws AxisFault {
OMElement response =
axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("TestCallProxy"), null, "WSO2");
boolean responseContainsWSO2 = response.getFirstElement().toString().contains("WSO2");
assertTrue(responseContainsWSO2);
response =
axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("TestCallProxy"), null, "IBM");
boolean responseContainsIBM = response.getFirstElement().toString().contains("IBM");
assertTrue(responseContainsIBM);
response =
axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("TestCallProxy"), null, "MSFT");
boolean responseContainsMSFT = response.getFirstElement().toString().contains("MSFT");
assertTrue(responseContainsMSFT);
}
示例6: selectOperation
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5, description = "invoke service",
dependsOnMethods = "testServiceDeployment", enabled = false)
public void selectOperation() throws AxisFault, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice/samples/gspread_sample_service", "ns1");
OMElement payload = fac.createOMElement("getCustomers", omNs);
OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName),
"getProducts");
log.info("Response : " + result);
Assert.assertTrue((result.toString().indexOf("Customers") == 1),
"Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<customerNumber>"),
"Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("</Customer>"),
"Expected Result not found on response message");
log.info("Service Invocation success");
}
示例7: createNewFile
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.dss"})
public void createNewFile() throws AxisFault, XPathExpressionException {
OMElement response;
OMElement payload;
payload = fac.createOMElement("_getcreatenewfile", omNs);
OMElement fileName = fac.createOMElement("fileName", omNs);
fileName.setText(txtFileName);
payload.addChild(fileName);
OMElement fileType = fac.createOMElement("fileType", omNs);
fileType.setText(txtFileType);
payload.addChild(fileType);
new AxisServiceClient().sendRobust(payload, getServiceUrlHttp(serviceName), "_getcreatenewfile");
response = checkFileExists();
Assert.assertEquals("1", response.getFirstElement().getFirstElement().getText(), "Expected Not same .File Not Exists");
log.info("New File Created");
}
示例8: testMBeanForDatasource
import org.apache.axis2.AxisFault; //导入依赖的package包/类
private MBeanInfo testMBeanForDatasource() throws Exception {
Map<String, String[]> env = new HashMap<>();
String[] credentials = { "admin", "admin" };
env.put(JMXConnector.CREDENTIALS, credentials);
try {
String url = "service:jmx:rmi://localhost:12311/jndi/rmi://localhost:11199/jmxrmi";
JMXServiceURL jmxUrl = new JMXServiceURL(url);
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl, env);
MBeanServerConnection mBeanServer = jmxConnector.getMBeanServerConnection();
ObjectName mbeanObject = new ObjectName(dataSourceName + ",-1234:type=DataSource");
MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(mbeanObject);
return mBeanInfo;
} catch (MalformedURLException | MalformedObjectNameException | IntrospectionException |
ReflectionException e) {
throw new AxisFault("Error while connecting to MBean Server " + e.getMessage(), e);
}
}
示例9: testSoap12FaultMessage
import org.apache.axis2.AxisFault; //导入依赖的package包/类
/**
* To check the validity of fault response
* Test artifacts : mediatorconfig/fault/soap12_fault_response_validate_synapse.xml
*
* @throws Exception
*/
@Test(groups = "wso2.esb", enabled = false)
public void testSoap12FaultMessage() throws Exception {
try {
axis2Client.sendSimpleStockQuoteSoap12(getMainSequenceURL(),
"http://localhost:9020/services/NonExistingService",
"MSFT");
Assert.fail("Expected Axis Fault not occurred ");
} catch (AxisFault expected) {
log.info("Fault Message : " + expected.getMessage());
assertTrue(expected.getReason().contains("Connection refused"), "ERROR Message mismatched." +
" Not Contain Connection refused or." +
" actual message:" + expected.getMessage());
assertEquals(expected.getFaultCode().getLocalPart(), "Receiver", "Fault code value mismatched");
assertEquals(expected.getFaultCode().getPrefix(), "tns", "Fault code prefix mismatched");
}
}
示例10: testJmsResponse
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Test Sending message to a jms endpoint and check for response")
public void testJmsResponse() throws Exception {
try {
axis2Client.sendSimpleStockQuoteRequest(getMainSequenceURL(),
null, "IBM");
} catch (AxisFault fault) {
String errMsg=fault.getMessage();
Assert.assertEquals(errMsg,"Send timeout", "JMS Client did not receive Send timeout");
LogViewerClient cli = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
LogEvent[] logs = cli.getAllSystemLogs();
Assert.assertNotNull(logs, "No logs found");
Assert.assertTrue(logs.length > 0, "No logs found");
boolean errorMsgTrue = Utils.checkForLogsWithPriority(cli,"ERROR", logLine0, 10);
Assert.assertTrue(errorMsgTrue, "Axis Fault Did not receive");
}
}
示例11: setInvokerName
import org.apache.axis2.AxisFault; //导入依赖的package包/类
public void setInvokerName(String invokerName) {
this.invokerName = invokerName;
if (statefull) {
client.getOptions().setManageSession(true);
client.getOptions().setAction("setClientName");
OMElement cName = fac.createOMElement("cName", null);
cName.setText(invokerName);
try {
OMElement response = client.sendReceive(cName);
System.out.println(response.getText());
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
}
}
}
示例12: testSOAP12FaultCodeReceiver
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.2 fault code Receiver")
public void testSOAP12FaultCodeReceiver() throws AxisFault {
try {
axis2Client.sendSimpleStockQuoteSoap12(
getMainSequenceURL(),
null,
"WSO2");
fail("This query must throw an exception.");
} catch (AxisFault expected) {
log.info("Fault Message : " + expected.getMessage());
assertEquals(expected.getReason(), "Soap12FaultCodeReceiverTestCase", "Fault Reason Mismatched");
assertEquals(expected.getFaultCode().getLocalPart(), "Receiver", "Fault code value mismatched");
assertEquals(expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched");
}
}
示例13: testSOAP11FullFaultMessage
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.1 fault messages all fault values")
public void testSOAP11FullFaultMessage() throws AxisFault {
try {
axis2Client.sendSimpleStockQuoteRequest(
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(), "Custom ERROR Message", "Custom ERROR Message mismatched");
assertEquals(expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched");
assertEquals(expected.getFaultCode().getPrefix(), "soap11Env", "Fault code prefix mismatched");
assertEquals(expected.getFaultRoleElement().getRoleValue(), "automation", "Role mismatched");
assertEquals(expected.getFaultDetailElement().getText(), "fault details by automation", "Fault detail mismatched");
}
}
示例14: getUserStoreDomains
import org.apache.axis2.AxisFault; //导入依赖的package包/类
/**
* Get User Store Domains
*
* @return
* @throws AxisFault
*/
public String[] getUserStoreDomains() throws AxisFault {
try {
List<String> readWriteDomainNames = new ArrayList<String>();
UserStoreInfo[] storesInfo = userAdminStub.getUserRealmInfo().getUserStoresInfo();
for (UserStoreInfo storeInfo : storesInfo) {
if (!storeInfo.getReadOnly()) {
readWriteDomainNames.add(storeInfo.getDomainName());
}
}
return readWriteDomainNames.toArray(new String[readWriteDomainNames.size()]);
} catch (RemoteException | UserAdminUserAdminException e) {
throw new AxisFault("Error occurred while retrieving Read-Write User Store Domain IDs for logged-in" +
" user's tenant realm");
}
}
示例15: artifactDeploymentAndServiceInvocation
import org.apache.axis2.AxisFault; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "test endpoint deployment from car file")
public void artifactDeploymentAndServiceInvocation() throws Exception {
Assert.assertTrue(esbUtils.isEndpointDeployed(context.getContextUrls().getBackEndUrl(), getSessionCookie(), "stockQuoteServiceEndpoint")
, "AddressEndpoint Endpoint deployment failed");
Assert.assertTrue(esbUtils.isProxyDeployed(context.getContextUrls().getBackEndUrl(), getSessionCookie(), "xsltTransformationProxy")
, "Pass Through Proxy service deployment failed");
Assert.assertTrue(isResourceExist("/_system/config/transform.xslt"), "transform.xslt not found on registry");
Assert.assertTrue(isResourceExist("/_system/config/transform_back.xslt"), "transform.xslt not found on registry");
OMElement response = null;
try {
response = axis2Client.sendCustomQuoteRequest(
getProxyServiceURLHttp("xsltTransformationProxy"),
null,
"XSLTTransformation");
} catch (AxisFault axisFault) {
throw new Exception("Service Invocation Failed > " + axisFault.getMessage(), axisFault);
}
Assert.assertNotNull(response, "Response message null");
Assert.assertTrue(response.toString().contains("Code"), "Code element not found in response message");
Assert.assertTrue(response.toString().contains("XSLTTransformation"), "Symbol not found on the response message");
}