Click here to Skip to main content
15,877,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using this code snippet to invoke a web service through the end point URL path but I am unable to understand the use of "Options" class.

Whenever I am using more timeout milli second(say 500000) then the application before reaching the required timeout is showing "session or cookie not found" exception instead of showing the "timeout error".But using less timeout it is working fine showing the timeout error. why is it so?


Please anyone help me.
Thanks in advance.

ServiceClient client = new ServiceClient();
OperationClient operationClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext outMsgCtx = new MessageContext();
Options opts = outMsgCtx.getOptions();
opts.setTimeOutInMilliSeconds(2000);
opts.setTo(new EndpointReference(<<URL PATH>>));
opts.setAction(<<ACTION METHOD NAME>>);
outMsgCtx.setEnvelope(<<INPUT SOAP ENVELOP>>);
operationClient.addMessageContext(outMsgCtx);
operationClient.execute(true);
MessageContext inMsgtCtx = operationClient.getMessageContext("In");
SOAPEnvelope response = inMsgtCtx.getEnvelope();
return response;
Posted
Comments
Arndt Faulhaber 4-Nov-11 15:10pm    
I think you should configure Timeouts rather in your Apache config rather than in you Program (except if you only have very specific occurrences where you need to increase the timeout) - Have a look at the configuration options you have available (besides are we talking apache http server or apache tomcat?)
Be Yourself 19-Nov-11 10:02am    
It's a http server. yes although the time out in apache application server in the web.xml file is set to 120 mins even after 1 min the application shows cookie not found exception. according to me it should wait for the response. even if I increase the time out in code from 2000 to 900000 the same problem is there. there is no effect of this timeout please explain me where to set the time out and what?
Flint-Bear 23-Nov-11 11:46am    
The cookie may have a timeout set. Check the expiration time for the cookie.
Be Yourself 12-Dec-11 22:40pm    
Thanks..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900