[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
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,378 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

650 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