当前位置: 首页>>代码示例>>Java>>正文


Java Constants类代码示例

本文整理汇总了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();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:FaultHandlingTest.java

示例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);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:AxisOperationClient.java

示例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");

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:Sample700TestCase.java

示例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");

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:Sample701TestCase.java

示例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");

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:23,代码来源:Sample702TestCase.java

示例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");
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:Sample704TestCase.java

示例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");
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:27,代码来源:ESBJAVA4909MultipartRelatedTestCase.java

示例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>"));
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:26,代码来源:CallOutMediatorWithMTOMTestCase.java

示例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);
        }
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:29,代码来源:IntegratorStatefulHandler.java

示例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;
	}
 
开发者ID:jembi,项目名称:openxds,代码行数:21,代码来源:XdsTest.java

示例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);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:ConfigurationContext.java

示例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() );

          }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:PojoTest.java

示例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");
        }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:JAXRSUtils.java

示例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);

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:AdminAgent.java

示例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);
            }
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:32,代码来源:DependencyManager.java


注:本文中的org.apache.axis2.Constants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。