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


Java Options.setTimeOutInMilliSeconds方法代码示例

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


在下文中一共展示了Options.setTimeOutInMilliSeconds方法的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: setupValidationService

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
 * 
 * @param stub
 * @return receives a non prepared stub and set up it
 */
private OAuth2TokenValidationServiceStub setupValidationService(OAuth2TokenValidationServiceStub stub) {
    AuthProperties props = AuthProperties.inst();

    ServiceClient client = stub._getServiceClient();
    Options options = client.getOptions();

    CarbonUtils.setBasicAccessSecurityHeaders(props.getWso2User(), props.getWso2Password(), true, client);

    options.setTimeOutInMilliSeconds(TIMEOUT_IN_MILLIS);
    options.setProperty(HTTPConstants.SO_TIMEOUT, TIMEOUT_IN_MILLIS);
    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIMEOUT_IN_MILLIS);
    options.setCallTransportCleanup(true);
    options.setManageSession(true);

    return stub;
}
 
开发者ID:romulets,项目名称:wso2is-example,代码行数:22,代码来源:TokenValidationService.java

示例3: 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

示例4: authenticateStub

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    System.out.println("XXXXXXXXXXXXXXXXXXX" +
                       backendURL +  client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", ""));
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    option.setTo(new EndpointReference(backendURL +  client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", "")));
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }

    return stub;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:AuthenticateStub.java

示例5: authenticateStub

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    System.out.println("XXXXXXXXXXXXXXXXXXX" +
            backendURL +  client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", ""));
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    option.setTo(new EndpointReference(backendURL +  client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", "")));
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }

    return stub;
}
 
开发者ID:DistX,项目名称:Learning,代码行数:18,代码来源:AuthenticateStub.java

示例6: prepareStubInternal

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private void prepareStubInternal(Stub stub)
{
    Options options = stub._getServiceClient().getOptions();
    options.setExceptionToBeThrownOnSOAPFault(true);
    options.setTimeOutInMilliSeconds(timeout);
    options.setManageSession(true);
    if (sessionCookie != null)
    {
        options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
    }
    options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);

    if (httpUsername != null && httpUsername.length() >= 0 && httpPassword != null)
    {
        HttpTransportProperties.Authenticator authenticator =
            new HttpTransportProperties.Authenticator();
        authenticator.setUsername(httpUsername);
        authenticator.setPassword(httpPassword);
        options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
    }
}
 
开发者ID:hschott,项目名称:cargo-wso2-container,代码行数:22,代码来源:AbstractWSO2Carbon4xRemoteService.java

示例7: getOperationClient

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private static OperationClient getOperationClient(MessageContext partnerMessageContext,
                                                  ConfigurationContext clientConfigCtx)
        throws AxisFault {

    AxisService anonymousService =
            AnonymousServiceFactory.getAnonymousService(Constants.registrationService,
                    Constants.REGISTRATION_PORT,
                    clientConfigCtx.getAxisConfiguration(), Constants.HUMANTASK_COORDINATION_MODULE_NAME);

    anonymousService.getParent().addParameter("hiddenService", "true");
    ServiceGroupContext sgc = new ServiceGroupContext(clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

    AxisOperation axisAnonymousOperation = anonymousService.getOperation(ServiceClient.ANON_OUT_IN_OP);

    Options clientOptions = cloneOptions(partnerMessageContext.getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);

    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:23,代码来源:ServiceUtils.java

示例8: getOperationClient

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private static OperationClient getOperationClient(ServiceInvocationContext partnerMessageContext,
                                                  ConfigurationContext clientConfigCtx)
        throws AxisFault {
    AxisService anonymousService =
            AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(),
                    partnerMessageContext.getPort(),
                    clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
    anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().getModule("UEPModule"));
    anonymousService.getParent().addParameter(
            "hiddenService", "true");
    ServiceGroupContext sgc = new ServiceGroupContext(
            clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

    // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
    AxisOperation axisAnonymousOperation = anonymousService.getOperation(
            partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP :
                    ServiceClient.ANON_OUT_ONLY_OP);

    Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);

    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:AxisServiceUtils.java

示例9: testEchoXMLMultipleDuelSync

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLMultipleDuelSync() throws Exception {
    OMElement payload = TestingUtils.createDummyOMElement();
    Options options = new Options();
    options.setTo(targetEPR);

    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setUseSeparateListener(true);
    options.setTimeOutInMilliSeconds(50000);

    ConfigurationContext configContext =
            ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                    TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
                    TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo/conf/axis2.xml"));
    ServiceClient sender = new ServiceClient(configContext, null);
    options.setAction(Constants.AXIS2_NAMESPACE_URI + "/" + operationName.getLocalPart());
    options.setAction("urn:echoOMElement");
    sender.setOptions(options);

    for (int i = 0; i < 5; i++) {
        OMElement result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
    }
    sender.cleanup();
    configContext.terminate();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:EchoRawXMLMultipleSyncTest.java

示例10: createClient

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private ServiceClient createClient() throws Exception {
    Options options = new Options();
    options.setTo(targetEPR);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setAction(operationName.getLocalPart());
    options.setUseSeparateListener(true);
    options.setTimeOutInMilliSeconds(50000);

    ConfigurationContext configContext = UtilServer.createClientConfigurationContext();

    ServiceClient sender = new ServiceClient(configContext, null);
    sender.setOptions(options);
    sender.engageModule("addressing");
    return sender;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:PausingHandlerExecutionTest.java

示例11: updateServiceClientOptions

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private void updateServiceClientOptions(String trpUrl, String addUrl, String prxUrl) throws AxisFault {
    Options options = new Options();
    options.setTo(new EndpointReference(trpUrl));
    options.setAction("urn:sampleOperation");
    options.setTimeOutInMilliSeconds(10000000);

    // set addressing, transport and proxy url
    if (addUrl != null && !"null".equals(addUrl)) {
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference(addUrl));
    }
    if (trpUrl != null && !"null".equals(trpUrl)) {
        options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
    } else {
        serviceClient.engageModule("addressing");
    }
    serviceClient.engageModule("addressing");
    if (prxUrl != null && !"null".equals(prxUrl)) {
        HttpTransportProperties.ProxyProperties proxyProperties =
            new HttpTransportProperties.ProxyProperties();
        try {
            URL url = new URL(prxUrl);
            proxyProperties.setProxyName(url.getHost());
            proxyProperties.setProxyPort(url.getPort());
            proxyProperties.setUserName("");
            proxyProperties.setPassWord("");
            proxyProperties.setDomain("");
            options.setProperty(HTTPConstants.PROXY, proxyProperties);
        } catch (MalformedURLException e) {
            String msg = "Error while creating proxy URL";
            log.error(msg, e);
            throw new AxisFault(msg, e);
        }
    }
    serviceClient.setOptions(options);
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:37,代码来源:LoadBalanceSessionFullClient.java

示例12: authenticateStub

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
 * Stub authentication method
 *
 * @param stub          valid stub
 * @param sessionCookie session cookie
 */
public static void authenticateStub(String sessionCookie, Stub stub) {
    long soTimeout = 5 * 60 * 1000; // Three minutes

    ServiceClient client = stub._getServiceClient();
    Options option = client.getOptions();
    option.setManageSession(true);
    option.setTimeOutInMilliSeconds(soTimeout);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
    if (log.isDebugEnabled()) {
        log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:19,代码来源:AuthenticateStubUtil.java

示例13: restoreToDefaults

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
 * Restores to the default log.
 *
 * @throws Exception exception from the {@link LoggingAdminStub}
 */
public void restoreToDefaults() throws Exception {
    try {
        ServiceClient client = loggingAdminStub._getServiceClient();
        Options option = client.getOptions();
        option.setTimeOutInMilliSeconds(1000 * 180);
        loggingAdminStub.restoreDefaults();
    } catch (Exception e) {
        String msg = "Error occurred while restoring global log4j configuration.";
        log.error(msg, e);
        throw e;
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:LoggingAdminClient.java

示例14: sessionlessClient

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

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement value = fac.createOMElement("Value", null);
        value.setText("Sample string");

        Options options = new Options();
        options.setTo(new EndpointReference("http://localhost:8480/services/LBService1"));

        options.setAction("urn:sampleOperation");


        long timeout = Integer.parseInt(getProperty("timeout", "10000000"));
        System.out.println("timeout=" + timeout);
        options.setTimeOutInMilliSeconds(timeout);

        // set addressing, transport and proxy url
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference("http://localhost:8480"));

        serviceClient.setOptions(options);
        String testString = "";

        long i = 0;
        while (i < 100) {

            serviceClient.getOptions().setManageSession(true);
            OMElement responseElement = serviceClient.sendReceive(value);
            String response = responseElement.getText();

            i++;
            System.out.println("Request: " + i + " ==> " + response);
            testString = testString.concat(":" + i + ">" + response + ":");
        }

        return testString;
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:38,代码来源:LoadbalanceFailoverClient.java

示例15: sendLoadBalanceRequest

import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
 * This method is used to send a single request to the load balancing service
 * @param proxyURL will be the location where load balancing proxy or sequence is defined.
 * @param serviceURL will be the URL for LBService
 * @return the response
 * @throws org.apache.axis2.AxisFault
 */
public String sendLoadBalanceRequest(String proxyURL,String serviceURL) throws AxisFault {

    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMElement value = fac.createOMElement("Value", null);
    value.setText("Sample string");

    Options options = new Options();
    if (proxyURL != null && !"null".equals(proxyURL)) {
        options.setTo(new EndpointReference(proxyURL));
    }

    options.setAction("urn:sampleOperation");

    long timeout = Integer.parseInt(getProperty("timeout", "10000000"));
    System.out.println("timeout=" + timeout);
    options.setTimeOutInMilliSeconds(timeout);

    if (serviceURL != null && !"null".equals(serviceURL)) {
        // set addressing, transport and proxy url
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference(serviceURL));
    }

    serviceClient.setOptions(options);

    serviceClient.getOptions().setManageSession(true);
    OMElement responseElement = serviceClient.sendReceive(value);
    String response = responseElement.getText();

    return response;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:39,代码来源:LoadbalanceFailoverClient.java


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