You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrew Clegg <an...@nervechannel.com> on 2009/02/14 14:06:12 UTC

[JAX-WS] Setting timeout for Service.create()

Hi,

Not sure if this is a CXF question or a JAX-WS API question...

Is there any way to set a timeout for javax.xml.ws.Service.create() ?
What happens if the operation to retrieve the WSDL from a remote URL
takes forever?

Cheers,

Andrew.

-- 
:: http://biotext.org.uk/ ::

Re: [JAX-WS] Setting timeout for Service.create()

Posted by Daniel Kulp <dk...@apache.org>.
That should be fine if you use the local copy of the wsdl.   (also double 
check any imports in it to make sure it isn't going off to grab the imports)

Dan

On Wed February 18 2009 4:14:50 pm Dale Ogilvie wrote:
> We have moved to loading local wsdl from file in WEB-INF/classes to
> avoid a hung ajp process in tomcat where the wsdl is unavailable.
>
>         URL wsdlURL =
> getClass().getClassLoader().getResource("/ourservice.wsdl");
>
>         Service s = new Service(wsdlURL);
>
> Once we have a service, we use the conduit timeouts, which seems to work
> for us.
>
>         com.acme.ourservice.ServiceSoap port = s.getServiceSoap12();
>
>         Client cl = ClientProxy.getClient(port);
>
>         HTTPConduit http = (HTTPConduit) cl.getConduit();
>
>         HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
>         httpClientPolicy.setConnectionTimeout(10000);
>         httpClientPolicy.setReceiveTimeout(45000);
>
>         http.setClient(httpClientPolicy);
>
> A question, will the above code fail if CXF ends up using URLConnection
> instead?
>
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Thursday, 19 February 2009 7:19 a.m.
> To: users@cxf.apache.org
> Cc: Andrew Clegg
> Subject: Re: [JAX-WS] Setting timeout for Service.create()
>
>
>
> Right now, the wsdl/schema retrieval just uses the normal
> java.net.URLConnection stuff.   Thus, I THINK there are system
> properties that
> can control that.
>
> There IS code in place to use our conduits (HTTPConduit) to get the
> wsdl, but it still tries the URLConnection thing first for right now and
> only does the conduit thing if that fails, except for https where it
> does the conduit thing
> first.   (I was too scared to make it do conduit thing first all the
> time,
> probably should re-look at that)
>
>
> Dan
>
> On Wed February 18 2009 12:09:31 pm Andrew Clegg wrote:
> > Anybody have any pointers for this one? Thanks :-)
> >
> > 2009/2/14 Andrew Clegg <an...@nervechannel.com>:
> > > Hi,
> > >
> > > Not sure if this is a CXF question or a JAX-WS API question...
> > >
> > > Is there any way to set a timeout for javax.xml.ws.Service.create()
>
> ?
>
> > > What happens if the operation to retrieve the WSDL from a remote URL
> > >
> > > takes forever?
> > >
> > > Cheers,
> > >
> > > Andrew.
> > >
> > > --
> > >
> > > :: http://biotext.org.uk/ ::
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: [JAX-WS] Setting timeout for Service.create()

Posted by Andrew Clegg <an...@nervechannel.com>.
Thanks for the hints guys. I'll look into the system properties for
URLConnection as Dan suggests -- I'd rather load them from the web as
we're doing a dynamically configurable service manager thing. I guess
one other option if that doesn't work is to try to create each service
in a separate thread which we can abandon after a given interval.

Andrew.


On 18/02/2009, Dale Ogilvie <Da...@trimble.co.nz> wrote:
>
> We have moved to loading local wsdl from file in WEB-INF/classes to
> avoid a hung ajp process in tomcat where the wsdl is unavailable.
>
>         URL wsdlURL =
> getClass().getClassLoader().getResource("/ourservice.wsdl");
>
>         Service s = new Service(wsdlURL);
>
> Once we have a service, we use the conduit timeouts, which seems to work
> for us.
>
>         com.acme.ourservice.ServiceSoap port = s.getServiceSoap12();
>
>         Client cl = ClientProxy.getClient(port);
>
>         HTTPConduit http = (HTTPConduit) cl.getConduit();
>
>         HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
>         httpClientPolicy.setConnectionTimeout(10000);
>         httpClientPolicy.setReceiveTimeout(45000);
>
>         http.setClient(httpClientPolicy);
>
> A question, will the above code fail if CXF ends up using URLConnection
> instead?
>
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Thursday, 19 February 2009 7:19 a.m.
> To: users@cxf.apache.org
> Cc: Andrew Clegg
> Subject: Re: [JAX-WS] Setting timeout for Service.create()
>
>
>
> Right now, the wsdl/schema retrieval just uses the normal
> java.net.URLConnection stuff.   Thus, I THINK there are system
> properties that
> can control that.
>
> There IS code in place to use our conduits (HTTPConduit) to get the
> wsdl, but it still tries the URLConnection thing first for right now and
> only does the conduit thing if that fails, except for https where it
> does the conduit thing
> first.   (I was too scared to make it do conduit thing first all the
> time,
> probably should re-look at that)
>
>
> Dan
>
>
> On Wed February 18 2009 12:09:31 pm Andrew Clegg wrote:
>> Anybody have any pointers for this one? Thanks :-)
>>
>> 2009/2/14 Andrew Clegg <an...@nervechannel.com>:
>> > Hi,
>> >
>> > Not sure if this is a CXF question or a JAX-WS API question...
>> >
>> > Is there any way to set a timeout for javax.xml.ws.Service.create()
> ?
>> > What happens if the operation to retrieve the WSDL from a remote URL
>
>> > takes forever?
>> >
>> > Cheers,
>> >
>> > Andrew.
>> >
>> > --
>> >
>> > :: http://biotext.org.uk/ ::
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>


-- 
:: http://biotext.org.uk/ ::

RE: [JAX-WS] Setting timeout for Service.create()

Posted by Dale Ogilvie <Da...@trimble.co.nz>.
We have moved to loading local wsdl from file in WEB-INF/classes to
avoid a hung ajp process in tomcat where the wsdl is unavailable.

        URL wsdlURL =
getClass().getClassLoader().getResource("/ourservice.wsdl");

        Service s = new Service(wsdlURL);

Once we have a service, we use the conduit timeouts, which seems to work
for us.

        com.acme.ourservice.ServiceSoap port = s.getServiceSoap12();
        
        Client cl = ClientProxy.getClient(port);

        HTTPConduit http = (HTTPConduit) cl.getConduit();

        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
        httpClientPolicy.setConnectionTimeout(10000);
        httpClientPolicy.setReceiveTimeout(45000);

        http.setClient(httpClientPolicy);

A question, will the above code fail if CXF ends up using URLConnection
instead?


-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Thursday, 19 February 2009 7:19 a.m.
To: users@cxf.apache.org
Cc: Andrew Clegg
Subject: Re: [JAX-WS] Setting timeout for Service.create()


 
Right now, the wsdl/schema retrieval just uses the normal 
java.net.URLConnection stuff.   Thus, I THINK there are system
properties that 
can control that.

There IS code in place to use our conduits (HTTPConduit) to get the
wsdl, but it still tries the URLConnection thing first for right now and
only does the conduit thing if that fails, except for https where it
does the conduit thing 
first.   (I was too scared to make it do conduit thing first all the
time, 
probably should re-look at that)


Dan


On Wed February 18 2009 12:09:31 pm Andrew Clegg wrote:
> Anybody have any pointers for this one? Thanks :-)
>
> 2009/2/14 Andrew Clegg <an...@nervechannel.com>:
> > Hi,
> >
> > Not sure if this is a CXF question or a JAX-WS API question...
> >
> > Is there any way to set a timeout for javax.xml.ws.Service.create()
?
> > What happens if the operation to retrieve the WSDL from a remote URL

> > takes forever?
> >
> > Cheers,
> >
> > Andrew.
> >
> > --
> >
> > :: http://biotext.org.uk/ ::

--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: [JAX-WS] Setting timeout for Service.create()

Posted by Daniel Kulp <dk...@apache.org>.
 
Right now, the wsdl/schema retrieval just uses the normal 
java.net.URLConnection stuff.   Thus, I THINK there are system properties that 
can control that.

There IS code in place to use our conduits (HTTPConduit) to get the wsdl, but 
it still tries the URLConnection thing first for right now and only does the 
conduit thing if that fails, except for https where it does the conduit thing 
first.   (I was too scared to make it do conduit thing first all the time, 
probably should re-look at that)


Dan


On Wed February 18 2009 12:09:31 pm Andrew Clegg wrote:
> Anybody have any pointers for this one? Thanks :-)
>
> 2009/2/14 Andrew Clegg <an...@nervechannel.com>:
> > Hi,
> >
> > Not sure if this is a CXF question or a JAX-WS API question...
> >
> > Is there any way to set a timeout for javax.xml.ws.Service.create() ?
> > What happens if the operation to retrieve the WSDL from a remote URL
> > takes forever?
> >
> > Cheers,
> >
> > Andrew.
> >
> > --
> >
> > :: http://biotext.org.uk/ ::

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: [JAX-WS] Setting timeout for Service.create()

Posted by Andrew Clegg <an...@nervechannel.com>.
Anybody have any pointers for this one? Thanks :-)

2009/2/14 Andrew Clegg <an...@nervechannel.com>:
> Hi,
>
> Not sure if this is a CXF question or a JAX-WS API question...
>
> Is there any way to set a timeout for javax.xml.ws.Service.create() ?
> What happens if the operation to retrieve the WSDL from a remote URL
> takes forever?
>
> Cheers,
>
> Andrew.
>
> --
> :: http://biotext.org.uk/ ::
>



-- 
:: http://biotext.org.uk/ ::