?
Solved

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

Posted on 2009-07-06
6
Medium Priority
?
5,337 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

762 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