You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Andi Waltl <an...@mytum.de> on 2007/08/13 22:18:13 UTC
Problems with sendReceiveNonBlocking - NullPointerException
Hi,
i have a problem with an asynchronous call with two connections.
My Client looks like this:
...
configurationContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(repositoryPath, axis2xml);
serviceClient = new ServiceClient(configurationContext, null);
serviceClient.engageModule(new QName(
org.apache.axis2.Constants.MODULE_ADDRESSING));
Options options = new Options();
options.setTo(endpointReference);
options.setUseSeparateListener(true);
options.setTransportInProtocol("http");
options.setAction("urn:listenForValues");
serviceClient.setOptions(options);
Callback callback = new Callback() {
public void onComplete(AsyncResult result) {
System.out .println("[WebServiceClient] ReceivingÂ…:\n"
+ result.getResponseEnvelope().getBody()
.getFirstElement());
}
public void onError(Exception e) {
e.printStackTrace();
}
};
OMFactory factory = OMAbstractFactory.getOMFactory();
serviceClient.sendReceiveNonBlocking(
createDummyOMElement("myElement"), callback);
public static OMElement createDummyOMElement(String opName) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://myns.de", "ns1");
OMElement method = fac.createOMElement(opName, omNs);
OMElement value = fac.createOMElement("myValue", omNs);
value.addChild(fac.createOMText(value, "Hello again"));
method.addChild(value);
return method;
}
Okay, now a service is called and i can watch the first interaction in tcp
monitor with an empty http response body.
Until now, everything seems to be as it should.
Then my client is starting a SimpleHttpServer on port 8088 (configured in
axis2.xml).
Then my Service is invoked:
public OMElement listenForValues(OMElement listenForValuesRequest) {
return getTestReply();
}
private static OMElement getTestReply() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement element = factory.createOMElement(new QName("testElement"));
element.setText("TestContent");
return element;
}
And before the service sends a response, an exception is thrown:
Exception in thread "Axis2 Task" java.lang.NullPointerException
at
org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver$1.handleResult(
AbstractInOutAsyncMessageReceiver.java:39)
at
org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver$2.run(AbstractI
nOutAsyncMessageReceiver.java:67)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
Task(ThreadPoolExecutor.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Unknown Source)
I don´t know what i am doing wrong and unfortunately spent lots of hours on
this problem. My service is, of course, configured with a
RawXMLINOutAsyncMessageReceiver. But the service itself sends no answer to
the
callback handler in a second connection.
Any ideas to solve the problem?
Thanks in advance!
Andi