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,228 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
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.

820 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