DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Why Queues Don’t Fix Scaling Problems
  • Reliable AI Agent Architecture for Mobile: Timeouts, Retries, and Idempotent Tool Calls
  • How to Identify the Underlying Causes of Connection Timeout Errors for MongoDB With Java
  • Understanding Server Error (5XX) in Azure Services: A Deep Dive Into Azure Logic Apps

Trending

  • Mocking Kafka for Local Spring Development
  • Your AI Agent Tests Are Passing, But Your Agent Is Still Broken
  • How to Write for DZone Publications: Trend Reports and Refcards
  • A Hands-On ABAP RESTful Programming Model Guide
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. How to Configure Timeout Duration on the Client Side for Axis2 Web Services

How to Configure Timeout Duration on the Client Side for Axis2 Web Services

By 
Singaram Subramanian user avatar
Singaram Subramanian
·
Jun. 18, 13 · Interview
Likes (0)
Comment
Save
Tweet
Share
21.0K Views

Join the DZone community and get the full member experience.

Join For Free

Axis2 uses CommonsHTTPTransportSender by default, which is based on commons-httpclient-3.1. At transport level, there’re two types of timeouts that can be set:

1. Socket Timeout
2. Connection Timeout

Here’s how you can configure the above ones:

Way #1: Configuring timeouts in axis2.xml

Socket Timeout
<parameter name=”SO_TIMEOUT”>some_integer_value</parameter>

Connection timeout
<parameter name=”CONNECTION_TIMEOUT”>some_integer_value</parameter>

Way #2: Configuring timeouts in code

    …
    Options options = new Options();
    options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeOutInMilliSeconds));
    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeOutInMilliSeconds));

    // or
    options.setTimeOutInMilliSeconds(timeOutInMilliSeconds);
    …

Real-life code: How to set timeout for a Axis2 Stub?

long timeout = 2 * 60 * 1000; // Two minutes
Stub stub = new TestStub();
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(soTimeout);
 
//or
 
long timeout = 2 * 60 * 1000; // Two minutes
Stub stub = new TestStub();
stub._getServiceClient().getOptions().setProperty(
                 HTTPConstants.SO_TIMEOUT, new Integer(timeOutInMilliSeconds));
stub._getServiceClient().getOptions().setProperty(
                 HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeOutInMilliSeconds));



Timeout (computing) Apache Axis2 Web Service

Published at DZone with permission of Singaram Subramanian. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Why Queues Don’t Fix Scaling Problems
  • Reliable AI Agent Architecture for Mobile: Timeouts, Retries, and Idempotent Tool Calls
  • How to Identify the Underlying Causes of Connection Timeout Errors for MongoDB With Java
  • Understanding Server Error (5XX) in Azure Services: A Deep Dive Into Azure Logic Apps

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook