AXIS2 Client call setting time-out

Source: Internet
Author: User

I'm using the axis2-1.6.2 version. Take a look at the following client code:

Import org.apache.axis2.client.Options;

Import com.ctis.ta.service.impl.OpenAccountForUnitServiceStub;
Import Com.ctis.ta.service.impl.OpenAccountForUnitServiceStub.OpenAndCheck;
Import Com.ctis.ta.service.impl.OpenAccountForUnitServiceStub.OpenAndCheckResponse;

public class Main {

public static void Main (string[] args) throws Exception {
Openaccountforunitservicestub is a class that is automatically generated by the Axis2 tool
Openaccountforunitservicestub stub = new Openaccountforunitservicestub ();
Openandcheck Openandcheck = new Openandcheck ();//openandcheck is a service-side approach
Openandcheck.setaddress ("");//Set the parameter value of the service-side method Openandcheck ()

Options options = Stub._getserviceclient (). GetOptions ();
Options.settimeoutinmilliseconds (3);//Set timeout (in milliseconds)
Stub._getserviceclient (). setoptions (options);

Openandcheckresponse response = Stub.openandcheck (Openandcheck);//Start calling the service-side method Openandcheck
string[] ret = Response.get_return ();//The server returns an array
System.out.println (ret.length);
}

}

If the above settings do not take effect, it is possible that your version is old. There is another way to try it:

Options.setproperty (Httpconstants.so_timeout, 300000);

Axis2 the bottom of the call is HttpClient, it is the default attempt to connect time is 60s, after establishing a connection, waiting to receive data time is 60s. The above notation is to extend the waiting time to receive data.


This article is from the "djh01" blog, make sure to keep this source http://djh01.blog.51cto.com/10177066/1702054

AXIS2 Client call setting time-out

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.