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