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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

691 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