Hallo Philip,
I had the same problem a few weeks ago. With SAAJ only I could not find
a way to configure the timeout. I did not find out how to modify the default
timeout in axis (still interested in a solution for that).
Anyway that would not help if I want to modify the timeout individually for
each call.
That is the solution I found:
Instead of using the standard JAAS way of sending the message (snippet 1)
I sent the message by using some Axis specific classes (snippet 2)
--snippet 1------------------------------------------------------------------
SOAPMessage message = // .... create your request message here
SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
con = scFactory.createConnection();
URLEndpoint endpoint = new URLEndpoint(getURLEndpoint());
SOAPMessage responseMessage = con.call(message, endpoint);
// consume the response message here...
----------------------------------------------------------------------------
--snippet 2------------------------------------------------------------------
SOAPMessage message = // .... create your request message here
Call call = new Call(getURLEndpoint());
((org.apache.axis.Message) message).setMessageContext(call.getMessageContext());
SOAPEnvelope env = ((org.apache.axis.Message)message).getSOAPEnvelope();
Attachments attachments = ((org.apache.axis.Message)
message).getAttachmentsImpl();
if (attachments != null) {
Iterator iterator = attachments.getAttachments().iterator();
while (iterator.hasNext()) {
Object attachment = iterator.next();
call.addAttachmentPart(attachment);
}
}
call.setReturnClass(SOAPMessage.class);
// set the timeout here
call.setTimeout(new Integer(getTimeout()));
call.invoke(env);
SOAPMessage responseMessage = call.getResponseMessage();
// consume the response message here...
----------------------------------------------------------------------------
-----Original Message-----
From: Philip Puccio [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 10, 2003 7:03 PM
To: [EMAIL PROTECTED]
Subject: Set timeout for SOAPMessage
Hi,
I've seen other threads asking about timeout and in the few cases where there
are responses, the solution lies in using Call.setTimeout(int).
I'm using SAAJ, so I'm dealing with a SOAPMessage. I see that MessageContext
implements setTimeout, but when I try to get the MessageContext from the
SOAPMessage (after casting down to Message so I can use getMessageContext() ) ,
I get null.
I *think* I'm heading in the right direction here -- most of my service calls
are very fast, so whatever the default timeout period is has been fine for me
so far. But now I'm implementing a call that can take 60 to 90 seconds, so I
would like to change the timeout only for the SOAPMessage that contains this
longer-running service call.
Thanks for any advice you can share on this,
. . . Phil
American Express made the following
annotations on 07/10/2003 10:02:39 AM
------------------------------------------------------------------------------
******************************************************************************
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
******************************************************************************
==============================================================================
