You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "doug.harmon" <do...@gmail.com> on 2010/02/19 16:08:01 UTC

Re: timeout not working for me

The "Using java code" section does not show an example for setting a timeout
on a javax.xml.ws.Dispatch object. When attempting to pass a dispatch object
to ClientProxy.getClient() I get an "IllegalArgumentException: not a proxy
instance" using cxf 2.2.2. How can I set the timeout in java using the
dispatch API of invoking a SOAP service? 


dkulp wrote:
> 
> 
> 
>>dispatchSOAP.getRequestContext().put("com.sun.xml.ws.connect.timeout",
>>new Integer(10*1000));
>>dispatchSOAP.getRequestContext().put("com.sun.xml.ws.request.timeout",
>>new Integer(10*1000));
> 
> Those keys are specific to Sun's implementation.   They won't work for
> CXF.
> 
> See the section about "Using java code" at:
> http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html
> to see how to set various timeouts and such.
> 
> Dan
> 
> 
> 
> On Tuesday 14 October 2008 10:16:45 am t-hunter wrote:
>> Hi,
>>
>> I have problem with timeout problem when calling CXF service using
>> JAX-WS.
>>
>> here is my code,
>>
>>
>>                         QName svcQName = new QName(getServiceNS(),
>> getServiceName());
>> 			QName portQName = new QName(getPortNS(), getPort());
>> 			Service service = Service.create(svcQName);
>> 			service.addPort(portQName,
>> SOAPBinding.SOAP11HTTP_BINDING,getEndpoint()); Dispatch dispatchSOAP=
>> service.createDispatch(portQName, SOAPMessage.class,
>> Service.Mode.MESSAGE);
>> 			dispatchSOAP.getRequestContext().put("com.sun.xml.ws.connect.timeout",
>> new Integer(10*1000));
>> 			dispatchSOAP.getRequestContext().put("com.sun.xml.ws.request.timeout",
>> new Integer(10*1000));
>>                         SOAPMessage response =
>> dispatchSOAP.invoke(message);
>>
>> I want generate timeout exception after 10 sec. But I'm getting response
>> in
>> 20 sec.
>>
>> Can any please assist me how to raise timeout exception after specified
>> time.
>> I'm using apache-cxf-2.1.2 distribution jar libray.
>>
>> Thanks in advance.
> 
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/timeout-is-not-working-tp19974436p27653174.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: timeout not working for me

Posted by Daniel Kulp <dk...@apache.org>.
Yea.   Dispatch isn't a proxy.  It's a concrete class.   You can do

((org.apache.cxf.jaxws.DispatchImpl)dispatch).getClient() to get the client 
out of it.

Dan


On Fri February 19 2010 10:08:01 am doug.harmon wrote:
> The "Using java code" section does not show an example for setting a
> timeout on a javax.xml.ws.Dispatch object. When attempting to pass a
> dispatch object to ClientProxy.getClient() I get an
> "IllegalArgumentException: not a proxy instance" using cxf 2.2.2. How can
> I set the timeout in java using the dispatch API of invoking a SOAP
> service?
> 
> dkulp wrote:
> >>dispatchSOAP.getRequestContext().put("com.sun.xml.ws.connect.timeout",
> >>new Integer(10*1000));
> >>dispatchSOAP.getRequestContext().put("com.sun.xml.ws.request.timeout",
> >>new Integer(10*1000));
> >>
> > Those keys are specific to Sun's implementation.   They won't work for
> > CXF.
> > 
> > See the section about "Using java code" at:
> > http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-supp
> > ort.html to see how to set various timeouts and such.
> > 
> > Dan
> > 
> > On Tuesday 14 October 2008 10:16:45 am t-hunter wrote:
> >> Hi,
> >> 
> >> I have problem with timeout problem when calling CXF service using
> >> JAX-WS.
> >> 
> >> here is my code,
> >> 
> >>                         QName svcQName = new QName(getServiceNS(),
> >> 
> >> getServiceName());
> >> 
> >> 			QName portQName = new QName(getPortNS(), getPort());
> >> 			Service service = Service.create(svcQName);
> >> 			service.addPort(portQName,
> >> 
> >> SOAPBinding.SOAP11HTTP_BINDING,getEndpoint()); Dispatch dispatchSOAP=
> >> service.createDispatch(portQName, SOAPMessage.class,
> >> Service.Mode.MESSAGE);
> >> 
> >> 			
dispatchSOAP.getRequestContext().put("com.sun.xml.ws.connect.timeout"
> >> 			,
> >> 
> >> new Integer(10*1000));
> >> 
> >> 			
dispatchSOAP.getRequestContext().put("com.sun.xml.ws.request.timeout"
> >> 			,
> >> 
> >> new Integer(10*1000));
> >> 
> >>                         SOAPMessage response =
> >> 
> >> dispatchSOAP.invoke(message);
> >> 
> >> I want generate timeout exception after 10 sec. But I'm getting response
> >> in
> >> 20 sec.
> >> 
> >> Can any please assist me how to raise timeout exception after specified
> >> time.
> >> I'm using apache-cxf-2.1.2 distribution jar libray.
> >> 
> >> Thanks in advance.

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