• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why is CONNECT_TIMEOUT defined in BindingProviderProperties?

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

JAX-WS wsimport generates a Service sub-class as below:



Now I use this code as in my web service client class as follows:



Now my question is - what is the point of setting, CONNECT_TIMEOUT in the above code,
since the Service class which opens the java.net.URLConnection to fetch the WSDL from the remote host, had already done so?
What I want to do is set a connection time out when the Service class attempts to get the WSDL.

Please don't tell me to modify the generated Service sub class constructor because, I don't like the idea of modifying a generated class.

Thanks
Meghana
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone?
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Would like to know why would you require a connect timeout when the WSDL is at a file location.

--
Regards,
Abhijit
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the sake of argument, lets assume we are loading the WSDL dynamically from a URL.
 
Abhijit Durge
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Meghana Reddy wrote:
public static void main(String a[]) {
orderService = new OrderProcess(); //Service sub-class is instantiated which immediately tries to connect to the WSDL URL.
// We don't have the opportunity to let the JAX-WS RI to use the connection timeout.


since the Service class which opens the java.net.URLConnection to fetch the WSDL from the remote host, had already done so?
What I want to do is set a connection time out when the Service class attempts to get the WSDL.



As with the snippet in your post, not able to see where the URL objects openConnection() or openStream() method is being called or URLConnection is being used. Please share the associated generated stub.



Meghana Reddy wrote:
Now my question is - what is the point of setting, CONNECT_TIMEOUT in the above code,



This is used when webservice client sends requests(executes a method) to the webService.

--
Regards,
Abhijit.
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the actual generated code that loads the WSDL from URL.



 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abhijit Durge wrote:
This is used when webservice client sends requests(executes a method) to the webService.



Are you sure? I think when the web service client sends requests , the "com.sun.xml.internal.ws.request.timeout" (which is the BindingProvider.REQUEST_TIMEOUT) setting controls this.
 
Abhijit Durge
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Meghana Reddy wrote:
baseUrl = com.order.process.gen.OrderService_Service.class.getResource(".");
//Here is where the CONNECT_TIMEOUT comes into picture
//since metro uses JDK's URLConnection class to obtain the WSDL.
//Since this is a generated class, we don't want to modify this and set a CONNECT_TIMEOUT here
url = new URL(baseUrl, "http://r8kmrzv:8080/orderweb/orderservice?wsdl");



1) Good to see now you are loading the WSDL from http instead of file.
2) Setting the following system properties will help you to provide timeouts when accessing the WSDL
sun.net.client.defaultConnectTimeout
sun.net.client.defaultReadTimeout

Meghana Reddy wrote:
Are you sure? I think when the web service client sends requests , the "com.sun.xml.internal.ws.request.timeout" (which is the BindingProvider.REQUEST_TIMEOUT) setting controls this.




Hope this gives you a better picture between the two:
CONNECT_TIMEOUT: It is the time taken to establish a (socket) connection
REQUEST_TIMEOUT: Maximum time between establishing a connection and receiving data from the connection.

--
Regards,
Abhijit.
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still didn't get the exact answer for my question.

AFAIK, the system properties will set the connect timeout at the system level which I don't want. I want to set the connect timeout for that specific URLConnection.

I understand the connect and request time outs.

// This is what I want which is what the service class will do when trying to fetch the WSDL from a URL but before we have a chance to get the port.
CONNECT_TIMEOUT: It is the time taken to establish a (socket) connection

// I'm not concerned about this. Because I can set this after obtaining the port and before invoking the business web service method.
REQUEST_TIMEOUT: Maximum time between establishing a connection and receiving data from the connection.

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Meghna ;

Shyam from bangalore; I am also faving the same problem . so finally where youy put the conection time out and receive time out in your code . means
what is exact place to put the conection time out and receive timeout .

puting this after getting port is write ?


- Thanks
reply
    Bookmark Topic Watch Topic
  • New Topic