本文整理汇总了Java中org.apache.axis2.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.apache.axis2包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResponse
import org.apache.axis2.Constants; //导入依赖的package包/类
private SOAPEnvelope getResponse(SOAPEnvelope inEnvelope) throws AxisFault {
ConfigurationContext confctx = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
null);
ServiceClient client = new ServiceClient(confctx, null);
Options options = new Options();
client.setOptions(options);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setExceptionToBeThrownOnSOAPFault(false);
MessageContext msgctx = new MessageContext();
msgctx.setEnvelope(inEnvelope);
OperationClient opClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
opClient.addMessageContext(msgctx);
opClient.execute(true);
return opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
}
示例2: setMessageContext
import org.apache.axis2.Constants; //导入依赖的package包/类
/**
* creating the message context of the soap message
*
* @param addUrl
* @param trpUrl
* @param action
*/
private void setMessageContext(String addUrl, String trpUrl, String action) {
outMsgCtx = new MessageContext();
//assigning message context’s option object into instance variable
Options options = outMsgCtx.getOptions();
//setting properties into option
if (trpUrl != null && !"null".equals(trpUrl)) {
options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
}
if (addUrl != null && !"null".equals(addUrl)) {
options.setTo(new EndpointReference(addUrl));
}
if(action != null && !"null".equals(action)) {
options.setAction(action);
}
}
示例3: messageStoringTest
import org.apache.axis2.Constants; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Introduction to Message Store test case ")
public void messageStoringTest() throws Exception {
// The count should be 0 as soon as the message store is created
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Message store should be initially empty");
// refer within a sequence through a store mediator, mediate messages
// and verify the messages are stored correctly in the store.
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(getBackEndServiceUrl("SimpleStockQuoteService")));
options.setAction("urn:placeOrder");
options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL());
serviceClient.setOptions(options);
serviceClient.sendRobust(createPayload());
Thread.sleep(30000);
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 1,
"Messages are missing or repeated");
}
示例4: messageStoreFIXStoringTest
import org.apache.axis2.Constants; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Introduction to Message Sampling Processor " +
"test case")
public void messageStoreFIXStoringTest() throws Exception {
// The count should be 0 as soon as the message store is created
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Message store should be initially empty");
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(getBackEndServiceUrl("StockQuoteProxy")));
options.setAction("urn:placeOrder");
options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL());
serviceClient.setOptions(options);
for (int i = 0; i < 10; i++) {
serviceClient.sendRobust(createPayload());
}
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) > 0,
"Messages are not stored");
}
示例5: messageStoringTest
import org.apache.axis2.Constants; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Introduction to Message Forwarding Processor " +
"test case")
public void messageStoringTest() throws Exception {
// The count should be 0 as soon as the message store is created
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Message store should be initially empty");
// refer within a sequence through a store mediator, mediate messages
// and verify the messages are stored correctly in the store.
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(getBackEndServiceUrl("SimpleStockQuoteService")));
options.setAction("urn:placeOrder");
options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL());
serviceClient.setOptions(options);
serviceClient.sendRobust(createPayload());
Thread.sleep(30000);
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Messages are not forwarded");
}
示例6: messageStoreFIXStoringTest
import org.apache.axis2.Constants; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "RESTful Invocations with Message Forwarding" +
" Processor test case")
public void messageStoreFIXStoringTest() throws Exception {
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(getBackEndServiceUrl("StockQuoteProxy")));
options.setAction("urn:placeOrder");
options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL());
serviceClient.setOptions(options);
for (int i = 0; i < 10; i++) {
serviceClient.sendRobust(createPayload());
}
Thread.sleep(2000);
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Messages are stored");
}
示例7: sendUsingMTOM
import org.apache.axis2.Constants; //导入依赖的package包/类
public void sendUsingMTOM(String fileName, String targetEPR) throws IOException {
final String EXPECTED = "<m0:uploadFileUsingMTOMResponse xmlns:m0=\"http://services.samples\"><m0:response>" +
"<m0:image>PHByb3h5PkFCQzwvcHJveHk+</m0:image></m0:response></m0:uploadFileUsingMTOMResponse>";
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns);
OMElement request = factory.createOMElement("request", ns);
OMElement image = factory.createOMElement("image", ns);
FileDataSource fileDataSource = new FileDataSource(new File(fileName));
DataHandler dataHandler = new DataHandler(fileDataSource);
OMText textData = factory.createOMText(dataHandler, true);
image.addChild(textData);
request.addChild(image);
payload.addChild(request);
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(targetEPR));
options.setAction("urn:uploadFileUsingMTOM");
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setCallTransportCleanup(true);
serviceClient.setOptions(options);
OMElement response = serviceClient.sendReceive(payload);
Assert.assertTrue(response.toString().contains(EXPECTED), "Attachment is missing in the response");
}
示例8: sendUsingMTOM
import org.apache.axis2.Constants; //导入依赖的package包/类
public void sendUsingMTOM(String fileName, String targetEPR) throws IOException {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns);
OMElement request = factory.createOMElement("request", ns);
OMElement image = factory.createOMElement("image", ns);
FileDataSource fileDataSource = new FileDataSource(new File(fileName));
DataHandler dataHandler = new DataHandler(fileDataSource);
OMText textData = factory.createOMText(dataHandler, true);
image.addChild(textData);
request.addChild(image);
payload.addChild(request);
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(targetEPR));
options.setAction("urn:uploadFileUsingMTOM");
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setCallTransportCleanup(true);
serviceClient.setOptions(options);
OMElement response = serviceClient.sendReceive(payload);
Assert.assertTrue(response.toString().contains(
"<m:testMTOM xmlns:m=\"http://services.samples/xsd\">" + "<m:test1>testMTOM</m:test1></m:testMTOM>"));
}
示例9: dispatchAndVerify
import org.apache.axis2.Constants; //导入依赖的package包/类
/**
* Finds axis Service and the Operation for DSS requests
*
* @param msgContext request message context
* @throws AxisFault if any exception occurs while finding axis service or operation
*/
private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
requestDispatcher.invoke(msgContext);
AxisService axisService = msgContext.getAxisService();
if (axisService != null) {
httpLocationBasedDispatcher.invoke(msgContext);
if (msgContext.getAxisOperation() == null) {
requestURIOperationDispatcher.invoke(msgContext);
}
AxisOperation axisOperation;
if ((axisOperation = msgContext.getAxisOperation()) != null) {
AxisEndpoint axisEndpoint =
(AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint != null) {
AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
.getBinding().getChild(axisOperation.getName());
msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
}
msgContext.setAxisOperation(axisOperation);
}
}
}
示例10: getOptions
import org.apache.axis2.Constants; //导入依赖的package包/类
protected Options getOptions(String action, boolean enableMTOM, String url) {
Options options = new Options();
options.setAction(action);
options.setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"1");
options.setTo( new EndpointReference(url) );
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
// try {
// String from = InetAddress.getLocalHost().getHostAddress();
// options.setFrom(new EndpointReference(from));
// }catch(UnknownHostException e) {
// //ignore From
// }
if (enableMTOM)
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
else
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_FALSE);
//use SOAP12,
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
return options;
}
示例11: cleanupTemp
import org.apache.axis2.Constants; //导入依赖的package包/类
/**
* This include all the major changes we have done from 1.2 release to 1.3 release. This will
* include API changes , class deprecating etc etc.
*/
private void cleanupTemp() {
File tempFile = (File)axisConfiguration.getParameterValue(
Constants.Configuration.ARTIFACTS_TEMP_DIR);
if (tempFile == null) {
String property = AccessController.doPrivileged(
new PrivilegedAction<String>() {
public String run() {
return System.getProperty("java.io.tmpdir");
}
}
);
tempFile = new File(property, "_axis2");
}
deleteTempFiles(tempFile);
}
示例12: testUpdateDataFromURL
import org.apache.axis2.Constants; //导入依赖的package包/类
public void testUpdateDataFromURL() throws Exception{
Options options= TestUtil.getPojoTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/update/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
String stringPayload = "<addDataFromURL xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1></addDataFromURL>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
assertEquals("account updated", returnElem.getText() );
}
示例13: addHTTPMethodToMethodModel
import org.apache.axis2.Constants; //导入依赖的package包/类
/**
* add value of the HTTPMethod to the jaxrs-method model. axis2 only supports POST,GET,PUT,DELETE.
* it doesnt support HEAD. if HEAD is given it resolves to the default method (POST)
* @param annotation
* @param methodModel
*/
private static void addHTTPMethodToMethodModel(Annotation annotation,JAXRSModel methodModel){
if (annotation instanceof POST) {
methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_POST);
} else if (annotation instanceof GET) {
methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_GET);
} else if (annotation instanceof PUT) {
methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_PUT);
} else if (annotation instanceof DELETE) {
methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_DELETE);
} else if (annotation instanceof HEAD) {
log.warn("HTTP Method HEAD is not supported by AXIS2");
}
}
示例14: processEngagingGlobally
import org.apache.axis2.Constants; //导入依赖的package包/类
public void processEngagingGlobally(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
Map<String,AxisModule> modules = configContext.getAxisConfiguration().getModules();
req.getSession().setAttribute(Constants.MODULE_MAP, modules);
String moduleName = req.getParameter("modules");
req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
if (moduleName != null) {
try {
configContext.getAxisConfiguration().engageModule(moduleName);
req.getSession().setAttribute(Constants.ENGAGE_STATUS,
moduleName + " module engaged globally successfully");
} catch (AxisFault axisFault) {
req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
}
}
req.getSession().setAttribute("modules", null);
renderView(ENGAGING_MODULE_GLOBALLY_JSP_NAME, req, res);
}
示例15: initService
import org.apache.axis2.Constants; //导入依赖的package包/类
/**
* To init all the services in application scope
*
* @param serviceGroupContext the ServiceGroupContext from which to extract all the services
* @throws AxisFault if there's a problem initializing
*/
public static void initService(ServiceGroupContext serviceGroupContext) throws AxisFault {
AxisServiceGroup serviceGroup = serviceGroupContext.getDescription();
Iterator<AxisService> serviceItr = serviceGroup.getServices();
while (serviceItr.hasNext()) {
AxisService axisService = (AxisService) serviceItr.next();
ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);
AxisService service = serviceContext.getAxisService();
ClassLoader classLoader = service.getClassLoader();
Parameter implInfoParam = service.getParameter(Constants.SERVICE_CLASS);
if (implInfoParam != null) {
try {
ThreadContextDescriptor tc = setThreadContext(axisService);
Class implClass = Loader.loadClass(
classLoader,
((String) implInfoParam.getValue()).trim());
Object serviceImpl = makeNewServiceObject(service);
serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl);
initServiceObject(serviceImpl, serviceContext);
restoreThreadContext(tc);
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
}
}