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


Java Options.setAction方法代码示例

本文整理汇总了Java中org.apache.axis2.client.Options.setAction方法的典型用法代码示例。如果您正苦于以下问题:Java Options.setAction方法的具体用法?Java Options.setAction怎么用?Java Options.setAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.client.Options的用法示例。


在下文中一共展示了Options.setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSoapOverUdpWithEchoService

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testSoapOverUdpWithEchoService() throws Exception {
    Options options = new Options();
    options.setTo(new EndpointReference("udp://127.0.0.1:3333?contentType=text/xml+soap"));
    options.setAction(Constants.AXIS2_NAMESPACE_URI + "/echoOMElement");
    options.setUseSeparateListener(true);
    options.setTimeOutInMilliSeconds(Long.MAX_VALUE);

    ServiceClient serviceClient = new ServiceClient(getClientCfgCtx(), null);
    serviceClient.setOptions(options);
    // We need to set up the anonymous service Axis uses to get the response
    AxisService clientService = serviceClient.getServiceContext().getAxisService();
    clientService.addParameter(UDPConstants.PORT_KEY, 4444);
    clientService.addParameter(UDPConstants.CONTENT_TYPE_KEY, "text/xml+soap");
    OMElement response = serviceClient.sendReceive(createPayload());
    
    assertEchoResponse(response);
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:18,代码来源:UDPTest.java

示例2: ParallelRequestHelper

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
 * constructor for parallel request helper
 * we can use this for the initial begin boxcarring request as well.(sending sessionCookie null)
 *
 * @param sessionCookie
 * @param operation
 * @param payload
 * @param serviceEndPoint
 * @throws org.apache.axis2.AxisFault
 */
public ParallelRequestHelper(String sessionCookie, String operation, OMElement payload, String serviceEndPoint) throws AxisFault {
    this.payload = payload;
    sender = new ServiceClient();
    Options options = new Options();
    options.setTo(new EndpointReference(serviceEndPoint));
    options.setProperty("__CHUNKED__", Boolean.FALSE);
    options.setTimeOutInMilliSeconds(45000L);
    options.setAction("urn:" + operation);
    sender.setOptions(options);
    if (sessionCookie != null && !sessionCookie.isEmpty()) {
        Header header = new Header("Cookie", sessionCookie);
        ArrayList headers = new ArrayList();
        headers.add(header);
        sender.getOptions().setProperty(HTTPConstants.HTTP_HEADERS, headers);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:27,代码来源:ParallelRequestHelper.java

示例3: setMessageContext

import org.apache.axis2.client.Options; //导入方法依赖的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

示例4: messageStoringTest

import org.apache.axis2.client.Options; //导入方法依赖的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

示例5: messageStoreFIXStoringTest

import org.apache.axis2.client.Options; //导入方法依赖的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

示例6: messageStoringTest

import org.apache.axis2.client.Options; //导入方法依赖的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

示例7: messageStoreFIXStoringTest

import org.apache.axis2.client.Options; //导入方法依赖的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

示例8: sendUsingMTOM

import org.apache.axis2.client.Options; //导入方法依赖的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

示例9: sendUsingMTOM

import org.apache.axis2.client.Options; //导入方法依赖的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

示例10: getOptions

import org.apache.axis2.client.Options; //导入方法依赖的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: testMutipleInvocation

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testMutipleInvocation() throws Exception {

        OMElement payload = TestingUtils.createDummyOMElement();
        Options options = new Options();
        options.setAction("urn:echoOM");
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setCallTransportCleanup(true);

        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        TestingUtils.prefixBaseDirectory(Constants.TESTING_REPOSITORY), null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.engageModule("addressing");
        sender.setOptions(options);
        OMElement result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
        result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
        result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
        result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:MultipleInvocationTest.java

示例12: testSaveAndRestoreOfMessage

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testSaveAndRestoreOfMessage() throws Exception {
    OMElement payload = TestingUtils.createDummyOMElement();
    Options options = new Options();
    options.setTo(TestConstants.targetEPR);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setAction(TestConstants.operationName.getLocalPart());
    options.setUseSeparateListener(true);

    ConfigurationContext configContext = UtilServer.createClientConfigurationContext();

    ServiceClient sender = new ServiceClient(configContext, null);
    sender.setOptions(options);
    sender.engageModule("addressing");

    OMElement result = sender.sendReceive(payload);

    TestingUtils.compareWithCreatedOMElement(result);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:MessageSaveAndRestoreTest.java

示例13: testSendRobustException

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testSendRobustException() throws Exception {

        EndpointReference targetEPR = new EndpointReference(
            "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
//                "http://127.0.0.1:" + 5556
                        + "/axis2/services/Echo/echoWithExeption");
        OMElement payload = createDummyOMElement();
        Options options = new Options();
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setAction("urn:echoWithExeption");
        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        try {
            sender.sendRobust(payload);
            TestCase.fail("Shoud get an exception");
        } catch (AxisFault axisFault) {
            assertEquals("Invoked the service", axisFault.getMessage());
        }

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

示例14: testOneWay

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testOneWay() throws Exception {
        ConfigurationContext configContext =
            ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                    TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH + "integrationRepo/"), null);
        ServiceClient sender = new ServiceClient(configContext, null);
        Options op = new Options();
//        op.setTo(new EndpointReference(
// //               "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
//                "http://127.0.0.1:" + 5556
//                        + "/axis2/services/"+service.getName()+"/"+operationName.getLocalPart()));
        op.setTo(targetEPR);
        op.setAction("urn:SomeAction");
        sender.setOptions(op);
        sender.fireAndForget(TestingUtils.createDummyOMElement());
        int index = 0;
        while (!received) {
            Thread.sleep(1000);
            index++;
            if (index == 20) {
                throw new AxisFault("error Occured");
            }
        }
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:OneWayRawXMLTest.java

示例15: sendGraceFullRestartRequest

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static void sendGraceFullRestartRequest(String backendURL, String userName,
                                               String password) throws AutomationFrameworkException {
    try {
        ServiceClient serviceClient = new ServiceClient();
        Options opts = new Options();
        opts.setManageSession(true);
        opts.setTo(new EndpointReference(backendURL + "/ServerAdmin"));
        opts.setAction("urn:restart");
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setUsername(userName);
        auth.setPassword(password);
        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);

        serviceClient.setOptions(opts);
        serviceClient.sendReceive(ClientConnectionUtil.createPayLoadRestartServerGracefully());

    } catch (AxisFault e) {
        log.error("Unable to restart carbon server gracefully..", e);
        throw new AutomationFrameworkException("Unable to restart carbon server gracefully..", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:22,代码来源:ClientConnectionUtil.java


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