the error and onComplete handlers of AxisCallback are called-back when there is
error or response has been generated
something like this should work:
AxisCallback callback = new AxisCallback() {
/**
* This is called when we receive a message.
*
* @param msgContext the (response) MessageContext
*/
public void onMessage(MessageContext msgContext) {
OMElement result =
msgContext.getEnvelope().getBody().getFirstElement();
TestingUtils.compareWithCreatedOMElement(result);
log.debug("result = " + result);
}
/**
* This gets called when a fault message is received.
*
* @param msgContext the MessageContext containing the fault.
*/
public void onFault(MessageContext msgContext) {
fail("Fault received");
}
/**
* This gets called ONLY when an internal processing exception
occurs.
*
* @param e the Exception which caused the problem
*/
public void onError(Exception e) {
}
/** This is called at the end of the MEP no matter what
happens, quite like a finally block. */
public void onComplete() {
finish = true;
notify();
}
};
sender.sendReceiveNonBlocking(payload, callback);
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
Date: Tue, 2 Aug 2011 14:22:23 -0700
Subject: Async axis client call timing out
From: [email protected]
To: [email protected]
Hi,
I'm experimenting with asynchronous calls between an axis client and an axis
server. The server is just the example1/MyService.java, slightly modified to
add a delay of a minute before replying. The client is based on the
EchoNonBlockingDualClient.java. I'm getting a Read timed out AxisFault after
30 seconds, which leads me to believe the client is leaving the channel open.
Here's some of the client code, with the options:
Options options = new Options();
options.setTo(targetEPR);
options.setAction("urn:echo");
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setUseSeparateListener(true);
//Callback to handle the response
BetterAxisCallback callback = new BetterAxisCallback();
//Non-Blocking Invocation
sender = new ServiceClient();
sender.engageModule(Constants.MODULE_ADDRESSING);
sender.setOptions(options);
sender.sendReceiveNonBlocking(payload, callback);
//Wait till the callback receives the response.
while(!callback.isComplete()) {
Thread.sleep(1000);
}
Shouldn't this wait indefinitely for a response on the separate listener?
Thanks,
Todd