You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by vijayvaleti <vv...@gmail.com> on 2010/08/23 10:29:20 UTC

Setting Http-conduit using spring configuration file

Hi,

I am using the following client configuration file for setting the receive
timeout options on the http-conduit object using a configurations file.

http://cxf.547215.n5.nabble.com/file/n2644363/clientConfig.xml
clientConfig.xml 

I am using the following client code.
http://cxf.547215.n5.nabble.com/file/n2644363/AuthServiceFactory.java
AuthServiceFactory.java 

her is my wsdl
http://cxf.547215.n5.nabble.com/file/n2644363/authorizationService.wsdl
authorizationService.wsdl 

timouts are defaulted to 60 sec always . please let me know if anything is
wrong in the configurations deatils. 

i am using apache cxf 2.2.6 and tomcat for this

Thanks
Vijay.v
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2644363.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by vijayvaleti <vv...@gmail.com>.
Hi Dan,

I have updated the client configuration file suggested by you, but still its
not timing out to the value what i have specified in the conduit. it is
always timesout to the default value only(i.e 60 secs).

please find the my updated client configuration file.

http://cxf.547215.n5.nabble.com/file/n2650771/clientConfig.xml
clientConfig.xml 

please let me know if any thing is wrong with the configuration file.

Thanks
Vijay.V
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2650771.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by vijayvaleti <vv...@gmail.com>.

I have updated the client configuration file suggested by you, but still its
not timing out to the value what i have specified in the conduit. it is
always timesout to the default value only(i.e 60 secs). 

please find the my updated client configuration file. 

http://cxf.547215.n5.nabble.com/file/n2651012/clientConfig.xml
clientConfig.xml 

please let me know if any thing is wrong with the configuration file. 

Thanks 
Vijay.V 
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2651012.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 07 April 2011 12:09:47 AM bcokee wrote:
> Hi Dan,
> 
>  I tried the interceptor like you said and it seems to work. Just have the
> ff. concerns:
> 
> 1. Is HttpConduit shared by all clients ? Like if I set a timeout like
> below, will it overwrite the timeout setting of other clients accessing
> same endpoint ?
> 
>    HTTPClientPolicy httpPolicy = createHttpPolicy();
>    HTTPConduit conduit = getHTTPConduit(client);
>    conduit.setClient(httpPolicy);
>    conduit.getClient().setReceiveTimeout(receiveTimeoutInMillis);

No.  The conduit is per client proxy.   If you share a single client proxy on 
multi-threads, that will be an issue.  But for a single proxy, that is fine.

> 
> 
> 2. Using the interceptor, if I apply a timeout using
> msg.put(Message.RECEIVE_TIMEOUT, ..)  on one operation, will it overwrite
> the timeout for other operations of the service ? Is this approach thread
> safe?

The msg is per request.   Anything set there doesn't affect anything else.

Dan

 
> I want each operation to have separate timeout values.
> 
> Thanks,
> Berns
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configur
> ation-file-tp2644363p4287702.html Sent from the cxf-user mailing list
> archive at Nabble.com.

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

Re: Setting Http-conduit using spring configuration file

Posted by mtuli <ma...@hotmail.com>.
Which interceptor i have to write for this ?

--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p4648334.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by bcokee <b_...@yahoo.com>.
Hi Dan,

 I tried the interceptor like you said and it seems to work. Just have the
ff. concerns:

1. Is HttpConduit shared by all clients ? Like if I set a timeout like
below, will it overwrite the timeout setting of other clients accessing same
endpoint ?

   HTTPClientPolicy httpPolicy = createHttpPolicy();
   HTTPConduit conduit = getHTTPConduit(client);
   conduit.setClient(httpPolicy);
   conduit.getClient().setReceiveTimeout(receiveTimeoutInMillis);


2. Using the interceptor, if I apply a timeout using
msg.put(Message.RECEIVE_TIMEOUT, ..)  on one operation, will it overwrite
the timeout for other operations of the service ? Is this approach thread
safe?

I want each operation to have separate timeout values.

Thanks,
Berns


--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p4287702.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 05 April 2011 7:27:02 AM bcokee wrote:
> Hi Dan,
> 
>  I'm also interested in knowing how to set a timeout per operation. At the
> moment I only
>  know how to apply timeout per service.

The only way to do it is by modifying the HTTPConduit prior to the individual 
call to the operation on the client (and realizing that that would not be 
thread safe) or installing an interceptor early in the out chain that would 
grab the operation and do something similar.   The interceptor could just do 
something like:

msg.getExchange().getBindingOperationInfo()

to get the operation.  Then look up the timeouts you need for that, and then 
do:

msg.put(Message.CONNECTION_TIMEOUT, ..)
msg.put(Message.RECEIVE_TIMEOUT, ..)


Dan



> 
> Daniel  Kulp wrote:
> >> 2. is it possibale to set the timeout per operation basis?
> > 
> > Not in config, no.   In code, before making the call, you can grab the
> > HttpConduit and modify settings right before the call.
> 
> Just to clarify my use case. Suppose we have a service like below:
> 
> public interface SomePortType
> {
> 
>        public   SomeRS  operation1RQ( ... ) ;
>        public   SomeRS  operation2RQ( ... ) ;
>        public   SomeRS  operation3RQ( ... ) ;
> 
> }
> 
>   I want to set different receive timeouts for each operation ( e.g. 5 sec,
> 10 sec. , 15 sec. respectively)
>   Could you please give more hints as to how  this can be achieved?
>   What settings of the conduit should be modified ?
>   Is one HttpConduit enough or  one conduit per operation ?
> 
>  Regards,
>  Berns
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configur
> ation-file-tp2644363p4283714.html Sent from the cxf-user mailing list
> archive at Nabble.com.

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

Re: Setting Http-conduit using spring configuration file

Posted by namhoa <na...@yahoo.com>.
Thanks. It is the answer me looking.

--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p5057667.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by bcokee <b_...@yahoo.com>.
Hi Dan,

 I'm also interested in knowing how to set a timeout per operation. At the
moment I only
 know how to apply timeout per service.


Daniel  Kulp wrote:
> 
> 
>> 
>> 2. is it possibale to set the timeout per operation basis?
> 
> Not in config, no.   In code, before making the call, you can grab the 
> HttpConduit and modify settings right before the call.  
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 


Just to clarify my use case. Suppose we have a service like below:

public interface SomePortType
{

       public   SomeRS  operation1RQ( ... ) ;
       public   SomeRS  operation2RQ( ... ) ;
       public   SomeRS  operation3RQ( ... ) ;     
    
}
 
  I want to set different receive timeouts for each operation ( e.g. 5 sec,
10 sec. , 15 sec. respectively)
  Could you please give more hints as to how  this can be achieved? 
  What settings of the conduit should be modified ?
  Is one HttpConduit enough or  one conduit per operation ?

 Regards,
 Berns


--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p4283714.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 06 September 2010 7:32:19 am vijayvaleti wrote:
> Hi,
> 
> Any one have idea on how to use connection pooling on CXF server side
> components.

It should be automatic by default.   For a servlet based service, the 
container you are running in may have some controls over the connection counts 
and such.   For the internal jetty stuff, you may need to grab the internal 
Jetty server thing and configure things with it via java code.   Not really 
sure. 

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

Re: Setting Http-conduit using spring configuration file

Posted by vijayvaleti <vv...@gmail.com>.

Hi,

Any one have idea on how to use connection pooling on CXF server side
components.

Thanks
Vijay.V
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2804877.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by vijayvaleti <vv...@gmail.com>.
Hi Dan,

Thanks for your quick response . it is very helpfull.

In your prevous reply you mentioned that, There isn't much that can be done
to configure it client side for the http connection pooling.

I Have read the Server HTTP Transport section of the CXF web site , but i
couldnt able to find out there is a way for connection pooling on the server
side. 

could you please let me know how to configure the Http connection pool on
the server side.

Thanks
Vijay.V
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2797630.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 25 August 2010 7:05:01 am vijayvaleti wrote:
> Hi Dan,
> 
> It is working for me after including following import statements in my
> client config file.
>              <import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 
> Could you please explain me why we need to add the above imports?

When you don't use the imports, when a Bus is needed, it will create a default 
bus which would be using it's own spring context.   When the Bus looks for 
configuration, it would just look in that spring context since it wouldn't 
know about your context.  I THINK if you use a jaxws:client thing instead of a 
spring bean, it MAY wire the current context into the default bus.  Not really 
sure though.   However, if you use normal spring beans, not much we can do 
unless we create spring specific subclasses (which we could) that would be 
Spring ApplicationContextAware to to wire things.   Would be more of a 
documentation issue of "when to use JaxWsProxyFactoryBean or 
SpringJaxWsProxyFactoryBean" and such.


> I also have a couple of queries regarding the Conduit.
> 
> 1. is it possiable to define the conduit(Htttp-timeout) for diffrenet
> services which residing at same address?

Yea.   Exactly like you did.  However, you could also do it URL based:
<http-conf:conduit  name="http://localhost:8080/AuthService.*">...
<http-conf:conduit  name="http://localhost:8080/SecureService.*">...



> example:
> 
> <http-conf:conduit
> name="{http://test.com/}AuthorizationServicePort.http-conduit">
> 	<http-conf:client ConnectionTimeout="5000"	ReceiveTimeout="5000" />
> </http-conf:conduit>
> 
> <http-conf:conduit
> name="{http://test.com/}SecuirtServicePort.http-conduit">
> <http-conf:client ConnectionTimeout="3000"	ReceiveTimeout="3000" />
> </http-conf:conduit>
> 
> 2. is it possibale to set the timeout per operation basis?

Not in config, no.   In code, before making the call, you can grab the 
HttpConduit and modify settings right before the call.  

> 3. whether the Http-Conduit what we define in config is threadsafe?

Yes. The http:conduit element doesn't actually create anything.  It's actually 
and abstract thing that is used to configure HttpConduit objects later.

> 4. The connections(HTTP) what ever created while making a communication
> with endpoint is maintained in pool (http connection caching) if not there
> is any way to cache the connection using the config like number of
> connections ?

The HttpURLConnection thing we use under the covers does maintain a pool of 
connections.   There isn't much that can be done to configure it client side 
though. 


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

Re: Setting Http-conduit using spring configuration file

Posted by vijayvaleti <vv...@gmail.com>.
Hi Dan,

It is working for me after including following import statements in my
client config file.
             <import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

Could you please explain me why we need to add the above imports?

I also have a couple of queries regarding the Conduit.

1. is it possiable to define the conduit(Htttp-timeout) for diffrenet
services which residing at same address?

example:

<http-conf:conduit
name="{http://test.com/}AuthorizationServicePort.http-conduit">
	<http-conf:client ConnectionTimeout="5000"	ReceiveTimeout="5000" />
</http-conf:conduit>

<http-conf:conduit name="{http://test.com/}SecuirtServicePort.http-conduit">
	<http-conf:client ConnectionTimeout="3000"	ReceiveTimeout="3000" />
</http-conf:conduit>

2. is it possibale to set the timeout per operation basis?
3. whether the Http-Conduit what we define in config is threadsafe?

4. The connections(HTTP) what ever created while making a communication with
endpoint is maintained in pool (http connection caching) if not there is any
way to cache the connection using the config like number of connections ?
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2652504.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
That all looks fine to me.  May need a full sample to debug.

Dan


On Tuesday 24 August 2010 11:04:16 am vvvijayvaleti wrote:
> Hi Dan,
> 
> I have updated the client configuration file suggested by you, but still
> its not timing out to the value what i have specified in the conduit. it
> is always timesout to the default value only(i.e 60 secs).
> 
> please find the my updated client configuration file.
> 
> 
> please let me know if any thing is wrong with the configuration file.
> 
> Thanks
> Vijay.V
> 
> On Mon, Aug 23, 2010 at 7:23 PM, Daniel Kulp <dk...@apache.org> wrote:
> > Couple thoughts:
> > 
> > 1) You aren't setting the wsdlLocation attribute on the JaxWsProxyFactory
> > thing so it may be looking for a different endpoint name.    I would
> > suggest
> > completely filling in the extra details there including the wsdlLocation
> > and
> > serviceName and endpointName.
> > 
> > Alternatively:
> > 
> > 2) Change the http:conduit name to be a wildcard URL:
> > 
> > <http-conf:conduit name="http://localhost:8080/.*">
> > 
> >                <http-conf:client ReceiveTimeout="3000"/>
> > 
> > </http-conf:conduit>
> > 
> > 
> > which should catch it as well.
> > 
> > Dan
> > 
> > On Monday 23 August 2010 4:29:20 am vijayvaleti wrote:
> > > Hi,
> > > 
> > > I am using the following client configuration file for setting the
> > 
> > receive
> > 
> > > timeout options on the http-conduit object using a configurations file.
> > > 
> > > http://cxf.547215.n5.nabble.com/file/n2644363/clientConfig.xml
> > > clientConfig.xml
> > > 
> > > I am using the following client code.
> > > http://cxf.547215.n5.nabble.com/file/n2644363/AuthServiceFactory.java
> > > AuthServiceFactory.java
> > > 
> > > her is my wsdl
> > > http://cxf.547215.n5.nabble.com/file/n2644363/authorizationService.wsdl
> > > authorizationService.wsdl
> > > 
> > > timouts are defaulted to 60 sec always . please let me know if anything
> > 
> > is
> > 
> > > wrong in the configurations deatils.
> > > 
> > > i am using apache cxf 2.2.6 and tomcat for this
> > > 
> > > Thanks
> > > Vijay.v
> > 
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://dankulp.com/blog

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

Re: Setting Http-conduit using spring configuration file

Posted by vvvijayvaleti <vv...@gmail.com>.
Hi Dan,

I have updated the client configuration file suggested by you, but still its
not timing out to the value what i have specified in the conduit. it is
always timesout to the default value only(i.e 60 secs).

please find the my updated client configuration file.


please let me know if any thing is wrong with the configuration file.

Thanks
Vijay.V

On Mon, Aug 23, 2010 at 7:23 PM, Daniel Kulp <dk...@apache.org> wrote:

>
>
> Couple thoughts:
>
> 1) You aren't setting the wsdlLocation attribute on the JaxWsProxyFactory
> thing so it may be looking for a different endpoint name.    I would
> suggest
> completely filling in the extra details there including the wsdlLocation
> and
> serviceName and endpointName.
>
> Alternatively:
>
> 2) Change the http:conduit name to be a wildcard URL:
>
> <http-conf:conduit name="http://localhost:8080/.*">
>                <http-conf:client ReceiveTimeout="3000"/>
> </http-conf:conduit>
>
>
> which should catch it as well.
>
> Dan
>
>
> On Monday 23 August 2010 4:29:20 am vijayvaleti wrote:
> > Hi,
> >
> > I am using the following client configuration file for setting the
> receive
> > timeout options on the http-conduit object using a configurations file.
> >
> > http://cxf.547215.n5.nabble.com/file/n2644363/clientConfig.xml
> > clientConfig.xml
> >
> > I am using the following client code.
> > http://cxf.547215.n5.nabble.com/file/n2644363/AuthServiceFactory.java
> > AuthServiceFactory.java
> >
> > her is my wsdl
> > http://cxf.547215.n5.nabble.com/file/n2644363/authorizationService.wsdl
> > authorizationService.wsdl
> >
> > timouts are defaulted to 60 sec always . please let me know if anything
> is
> > wrong in the configurations deatils.
> >
> > i am using apache cxf 2.2.6 and tomcat for this
> >
> > Thanks
> > Vijay.v
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>



-- 
Regards
V.V.Vijay.Valeti

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.

Couple thoughts:

1) You aren't setting the wsdlLocation attribute on the JaxWsProxyFactory 
thing so it may be looking for a different endpoint name.    I would suggest 
completely filling in the extra details there including the wsdlLocation and 
serviceName and endpointName.    

Alternatively:

2) Change the http:conduit name to be a wildcard URL:

<http-conf:conduit name="http://localhost:8080/.*">
		<http-conf:client ReceiveTimeout="3000"/>
</http-conf:conduit>


which should catch it as well.

Dan


On Monday 23 August 2010 4:29:20 am vijayvaleti wrote:
> Hi,
> 
> I am using the following client configuration file for setting the receive
> timeout options on the http-conduit object using a configurations file.
> 
> http://cxf.547215.n5.nabble.com/file/n2644363/clientConfig.xml
> clientConfig.xml
> 
> I am using the following client code.
> http://cxf.547215.n5.nabble.com/file/n2644363/AuthServiceFactory.java
> AuthServiceFactory.java
> 
> her is my wsdl
> http://cxf.547215.n5.nabble.com/file/n2644363/authorizationService.wsdl
> authorizationService.wsdl
> 
> timouts are defaulted to 60 sec always . please let me know if anything is
> wrong in the configurations deatils.
> 
> i am using apache cxf 2.2.6 and tomcat for this
> 
> Thanks
> Vijay.v

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

Re: Setting Http-conduit using spring configuration file

Posted by vijayvaleti <vv...@gmail.com>.
i also tried separating the beans and http conduit properties in doffrent
config files still its not working

Thanks
vijay.v
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p2644383.html
Sent from the cxf-user mailing list archive at Nabble.com.