Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setting webservice timeout  RSS feed

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I just started on a project which uses websphere 5.
I am invoking a webservice and want to set timeout on my client
code so it does not
wait very long in case the server is not responding.
I am using send() and receive() on org.apache.soap.messaging.Message object. I do not see anywhere in the API a timeout setting method.
Please suggest to solve this problem.
Thanks
Roshan
 
Roshan Lal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The problem is solved. All I needed to do was override the default connection used by message's send method.
eg.
Message msg = new Message;

msg.setTransport(new SOAPHTTPConnection().setTimeout(someNumber));

msg.send(url,"", soapenvelope);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!