本文整理汇总了Java中org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContextFactory.createDefaultConfigurationContext方法的具体用法?Java ConfigurationContextFactory.createDefaultConfigurationContext怎么用?Java ConfigurationContextFactory.createDefaultConfigurationContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.context.ConfigurationContextFactory
的用法示例。
在下文中一共展示了ConfigurationContextFactory.createDefaultConfigurationContext方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authenticate
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
private boolean authenticate() throws Exception {
ConfigurationContext configurationContext;
configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
Map<String, TransportOutDescription> transportsOut =configurationContext
.getAxisConfiguration().getTransportsOut();
for (TransportOutDescription transportOutDescription : transportsOut.values()) {
transportOutDescription.getSender().init(configurationContext, transportOutDescription);
}
AuthenticationAdminStub authAdmin = new AuthenticationAdminStub(configurationContext,
serverUrl);
boolean isAuthenticated = authAdmin.login(userName, password, "localhost");
cookie = (String) authAdmin._getServiceClient().getServiceContext()
.getProperty(HTTPConstants.COOKIE_STRING);
authAdmin._getServiceClient().cleanupTransport();
return isAuthenticated;
}
示例2: initConfigurationContext
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
private void initConfigurationContext() throws Exception {
HttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager();
HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager);
File configFile = new File(DEFAULT_AXIS2_XML);
if (!configFile.exists()) {
configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
configurationContext.setProperty(HTTPConstants.DEFAULT_MAX_CONNECTIONS_PER_HOST, MAX_CONNECTIONS_PER_HOST);
} else {
configurationContext = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(DEFAULT_CLIENT_REPO, DEFAULT_AXIS2_XML);
}
configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
Map<String, TransportOutDescription> transportsOut =
configurationContext.getAxisConfiguration().getTransportsOut();
for (TransportOutDescription transportOutDescription : transportsOut.values()) {
if (Constants.TRANSPORT_HTTP.equals(transportOutDescription.getName()) ||
Constants.TRANSPORT_HTTPS.equals(transportOutDescription.getName())) {
transportOutDescription.getSender().init(configurationContext, transportOutDescription);
}
}
}
示例3: testVersion
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public void testVersion() {
XMLUnit.setIgnoreWhitespace(true);
File testResourceFile = new File(wsdlLocation);
try {
WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
new FileInputStream(testResourceFile));
AxisService axisService = builder.populateService();
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
AxisConfiguration axisConfig = configContext.getAxisConfiguration();
axisConfig.addService(axisService);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
axisService.printWSDL(baos);
assertXMLEqual(new FileReader(testResourceFile), new StringReader(new String(baos.toByteArray())));
} catch (Exception e) {
System.out.println("Error in WSDL : " + testResourceFile.getName());
System.out.println("Exception: " + e.toString());
fail("Caught exception " + e.toString());
} finally {
XMLUnit.setIgnoreWhitespace(false);
}
}
示例4: testFaultReason
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public void testFaultReason() throws Exception {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
OMElement response = soapFactory.createOMElement(new QName("testNs",
"test"));
String faultReason = "myFaultReason";
AxisFault fault = new AxisFault(new QName("myQname"), faultReason,
"myFaultNode", "myFaultRole", response);
ConfigurationContext cc = ConfigurationContextFactory
.createDefaultConfigurationContext();
MessageContext ctx = cc.createMessageContext();
SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
ctx.setEnvelope(fac.getDefaultEnvelope());
MessageContext faultCtx = MessageContextBuilder
.createFaultMessageContext(ctx, fault);
assertEquals(faultReason, Utils.getInboundFaultFromMessageContext(
faultCtx).getReason());
}
示例5: testNoBuilder
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
/**
* A builder is not added for the multipart/mixed as in the above test.
* @throws Exception
*/
public void testNoBuilder() throws Exception {
File file = getTestResourceFile("mime_message.txt");
MIMEBuilder mimeBuilder = new MIMEBuilder();
FileInputStream fis = new FileInputStream(file);
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
AxisConfiguration axisConfig = configContext.getAxisConfiguration();
MessageContext mc = new MessageContext();
mc.setConfigurationContext(configContext);
axisConfig.addMessageBuilder("multipart/related", new MIMEBuilder());
axisConfig.addMessageBuilder("application/soap+xml", new SOAPBuilder());
axisConfig.addMessageBuilder("text/xml", new SOAPBuilder());
axisConfig.addMessageBuilder("application/xop+xml", new MTOMBuilder());
axisConfig.addMessageBuilder("application/xml", new ApplicationXMLBuilder());
axisConfig.addMessageBuilder("application/x-www-form-urlencoded",
new XFormURLEncodedBuilder());
axisConfig.addParameter(Constants.Configuration.USE_DEFAULT_FALLBACK_BUILDER, "true");
OMElement envelope = TransportUtils.createSOAPMessage(mc,fis,"multipart/mixed;boundary=--MIMEBoundary258DE2D105298B756D");
assertTrue(envelope != null);
assertTrue(envelope instanceof SOAPEnvelope);
OMElement firstElement = ((SOAPEnvelope)envelope).getBody().getFirstElement();
assertTrue(firstElement instanceof OMSourcedElement);
assertTrue(((OMSourcedElement)firstElement).getDataSource() instanceof UnknownContentOMDataSource);
}
示例6: initializeRestClient
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
/**
* Initialize the rest client and set username and password of the user
*
* @param serverURL server URL
* @param username username
* @param password password
* @throws AxisFault
*/
private void initializeRestClient(String serverURL, String username, String password) throws AxisFault {
HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
authenticator.setUsername(username);
authenticator.setPassword(password);
authenticator.setPreemptiveAuthentication(true);
ConfigurationContext configurationContext;
try {
configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
} catch (Exception e) {
String msg = "Backend error occurred. Please contact the service admins!";
throw new AxisFault(msg, e);
}
HashMap<String, TransportOutDescription> transportsOut = configurationContext
.getAxisConfiguration().getTransportsOut();
for (TransportOutDescription transportOutDescription : transportsOut.values()) {
transportOutDescription.getSender().init(configurationContext, transportOutDescription);
}
this.restClient = new RestClient(serverURL, username, password);
}
示例7: CarbonRemoteUserStoreManger
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
/**
* @param realmConfig
* @param properties
* @throws Exception
*/
public CarbonRemoteUserStoreManger(RealmConfiguration realmConfig, Map properties)
throws Exception {
ConfigurationContext configurationContext = ConfigurationContextFactory
.createDefaultConfigurationContext();
Map<String, TransportOutDescription> transportsOut = configurationContext
.getAxisConfiguration().getTransportsOut();
for (TransportOutDescription transportOutDescription : transportsOut.values()) {
transportOutDescription.getSender().init(configurationContext, transportOutDescription);
}
String[] serverUrls = realmConfig.getUserStoreProperty(SERVER_URLS).split(",");
for (int i = 0; i < serverUrls.length; i++) {
remoteUserStore = new WSUserStoreManager(
realmConfig.getUserStoreProperty(REMOTE_USER_NAME),
realmConfig.getUserStoreProperty(PASSWORD), serverUrls[i],
configurationContext);
if (log.isDebugEnabled()) {
log.debug("Remote Servers for User Management : " + serverUrls[i]);
}
remoteServers.put(serverUrls[i], remoteUserStore);
}
this.realmConfig = realmConfig;
domainName = realmConfig.getUserStoreProperty(UserStoreConfigConstants.DOMAIN_NAME);
}
示例8: testFaultSerialization
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public void testFaultSerialization() throws Exception {
final String REASON = "ReasonValue";
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
SOAPFaultValue soapFaultValue = soapFactory
.createSOAPFaultValue(soapFaultCode);
soapFaultValue.setText(new QName(
SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, "Sender"));
SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
SOAPFaultText soapFaultText = soapFactory
.createSOAPFaultText(soapFaultReason);
soapFaultText.setText(REASON);
SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail();
QName qName = new QName("http://mycompany.com", "FaultException", "ex");
OMElement exception = soapFactory.createOMElement(qName,
soapFaultDetail);
exception.setText("Detail text");
AxisFault fault = new AxisFault(soapFaultCode, soapFaultReason, null,
null, soapFaultDetail);
ConfigurationContext cc = ConfigurationContextFactory
.createDefaultConfigurationContext();
MessageContext ctx = cc.createMessageContext();
SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
ctx.setEnvelope(fac.getDefaultEnvelope());
MessageContext faultCtx = MessageContextBuilder
.createFaultMessageContext(ctx, fault);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TransportUtils.writeMessage(faultCtx, bos);
String result = new String(bos.toByteArray());
// For right now, just making sure we have a test for AXIS2-2752
// Confirm reason was correctly processed
assertTrue("Incorrect or missing reason!", result.indexOf(REASON) > -1);
}
示例9: Java2WSDLBuilder
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public Java2WSDLBuilder() {
try {
ConfigurationContext configCtx = ConfigurationContextFactory
.createDefaultConfigurationContext();
axisConfig = configCtx.getAxisConfiguration();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例10: setUp
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
protected void setUp() throws Exception {
canRunTests();
if (!canRunTests) {
System.out.println("[WARNING] Aborting clustering tests");
return;
}
System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, Utils.getIpAddress());
// First cluster
configurationContext1 =
ConfigurationContextFactory.createDefaultConfigurationContext();
serviceGroup1 = createAxisServiceGroup(configurationContext1);
service1 = createAxisService(serviceGroup1);
ctxMan1 = getContextManager();
configMan1 = getConfigurationManager();
clusterManager1 = getClusterManager(configurationContext1, ctxMan1, configMan1);
clusterManager1.addParameter(domainParam);
clusterManager1.init();
System.out.println("---------- ClusteringAgent-1 successfully initialized -----------");
// Second cluster
configurationContext2 =
ConfigurationContextFactory.createDefaultConfigurationContext();
serviceGroup2 = createAxisServiceGroup(configurationContext2);
service2 = createAxisService(serviceGroup2);
ctxMan2 = getContextManager();
configMan2 = getConfigurationManager();
clusterManager2 = getClusterManager(configurationContext2, ctxMan2, configMan2);
clusterManager2.addParameter(domainParam);
clusterManager2.init();
System.out.println("---------- ClusteringAgent-2 successfully initialized -----------");
}
示例11: setUp
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
protected void setUp() throws Exception {
Thread.sleep(3000);
configurationContext1 = ConfigurationContextFactory.createDefaultConfigurationContext();
configurationContext2 = ConfigurationContextFactory.createDefaultConfigurationContext();
clusterManager1 = getClusterManager(configurationContext1);
clusterManager2 = getClusterManager(configurationContext2);
clusterManager1.getStateManager().setConfigurationContext(configurationContext1);
clusterManager2.getStateManager().setConfigurationContext(configurationContext2);
clusterManager1.getNodeManager().setConfigurationContext(configurationContext1);
clusterManager2.getNodeManager().setConfigurationContext(configurationContext2);
//giving both Nodes the same deployment configuration
axisConfiguration1 = configurationContext1.getAxisConfiguration();
serviceGroup1 = new AxisServiceGroup(axisConfiguration1);
service1 = new AxisService(serviceName);
serviceGroup1.addService(service1);
axisConfiguration1.addServiceGroup(serviceGroup1);
axisConfiguration2 = configurationContext2.getAxisConfiguration();
serviceGroup2 = new AxisServiceGroup(axisConfiguration2);
service2 = new AxisService(serviceName);
serviceGroup2.addService(service2);
axisConfiguration2.addServiceGroup(serviceGroup2);
//Initiating ClusterManagers
System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, Utils.getIpAddress());
try {
clusterManager1.init();
System.out.println("ClusteringAgent-1 successfully initialized");
System.out.println("*** PLEASE IGNORE THE java.net.ConnectException STACKTRACES. THIS IS EXPECTED ***");
clusterManager2.init();
System.out.println("ClusteringAgent-2 successfully initialized");
} catch (ClusteringFault e) {
String message =
"Could not initialize ClusterManagers. Please check the network connection";
System.out.println(message + ": " + e);
e.printStackTrace();
skipChannelTests = true;
}
}
示例12: getDefaultConfigurationContext
import org.apache.axis2.context.ConfigurationContextFactory; //导入方法依赖的package包/类
public static ConfigurationContext getDefaultConfigurationContext() throws Exception {
if (configCtx == null) {
configCtx = ConfigurationContextFactory.createDefaultConfigurationContext();
}
return configCtx;
}