Solved

How do I set a timeout on a Java Web Service client developed in Netbeans 6.5

Posted on 2009-07-06
6
5,171 Views
Last Modified: 2013-12-14
I have a web service client developed in netbeans using the wizard. The code all works fine most of the time, but if the Web Service is slow responding, then the client times out. i would like to increase the timeout period from the default which is a bit short for the nework and server times.

How can I set the timeout for the web service

The error I get is

com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection time out: connect
try { // Call Web Service Operation

                    jadewebservices.jtmwebservices.MailWeb service = new jadewebservices.jtmwebservices.MailWeb();

                    jadewebservices.jtmwebservices.MailWebSoap port = service.getMailWebSoap();

                    // TODO initialize WS operation arguments here

                    java.lang.String userId = myUser;

                    // TODO process result here

                    javax.xml.datatype.XMLGregorianCalendar result = port.initSynchSessionV2(userId);

//                    System.out.println("Result = "+result);

                    startDate=result.getDay()+"/"+result.getMonth()+"/"+result.getYear();

                } catch (Exception ex) {

                    allOK = false;

                    System.out.println("exc = " + ex);

                }

Open in new window

0
Comment
Question by:johna11
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Ronb23
ID: 24794988
Check the web.xml file. There should be
                           <session-config>
                                <session-timeout>
                                    30
                                </session-timeout>
                            </session-config>
 
0
 

Author Comment

by:johna11
ID: 24798084
Hi Ronb, thanks for the suggestion. I can't find a web.xml file anywhere relevant to my client. There are several in a Glassfish directory etc, but when I look at the files in the distribution directory, there are only all my class files, a set of class files for the web services and a manifest file.
0
 
LVL 4

Expert Comment

by:Ronb23
ID: 24798190
The project that you're making the web service calls from, is there a WEB-INF folder?
0
 

Author Comment

by:johna11
ID: 24808235
No. The client is just a plain java application with a main,java, I have made a couple of Java web applications and they do have the web.xml file there. It seems that NetBeans is not creating this folder or file for a standard application.
I wonder if I copied the folder across from my web app whether the java application would start using it?
0
 
LVL 4

Accepted Solution

by:
Ronb23 earned 500 total points
ID: 24813653
jadewebservices.jtmwebservices looks like a third-party library. If you don't have web.xml file then what you'll need to do is lookup the documentation of the library that you're using to find out if there is any way to set a timeout.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now