Hi Michel,
thanks for your reply, but unfortunately it doesn't solve the issue.
Given the following code:
public class AsyncEchoClient {
private static String toEpr = "http://localhost:8080/
axis2/services/ServiceClass";
public static void main(String[] args) {
ServiceClient sender = null;
try {
OMElement payload = ClientUtil.getEchoOMElement();
Options options = new Options();
options.setTo(new EndpointReference(toEpr));
options.setAction("urn:echo");
options.setUseSeparateListener(true);
ConfigurationContext context =
ConfigurationContextFactory.createConfigurationContextFromFileSystem
(
null,
null);
sender = new ServiceClient();
sender.setOptions(options);
sender.engageModule(new QName
(Constants.MODULE_ADDRESSING)); <----- line 48
Callback callback = new Callback
() {
@Override
public void onComplete(AsyncResult result) {
try {
StringWriter writer = new StringWriter();
result.getResponseEnvelope().serialize(
XMLOutputFactory.newInstance
().createXMLStreamWriter(
writer));
writer.flush();
System.out.println("================");
System.out.println("Result: " +
writer.toString());
System.out.println("================");
} catch (XMLStreamException e) {
onError(e);
}
}
@Override
public void onError(Exception error) {
error.printStackTrace();
}
};
System.err.println(payload == null);
sender.sendReceiveNonBlocking(payload, callback);
long i = 0;
while (! callback.isComplete()) {
i++;
}
System.out.println("Wait " +
i); } catch (AxisFault e) {
e.printStackTrace();
} finally {
try {
sender.finalizeInvoke();
} catch (AxisFault e) {
//
}
}
}
}
I still get
run-async:
[java] org.apache.axis2.AxisFault: Module not found
[java] at
org.apache.axis2.description.AxisService.engageModule
(AxisService.java:311)
[java] at
org.apache.axis2.client.ServiceClient.engageModule
(ServiceClient.java:273)
[java] at client.AsyncEchoClient.main
(AsyncEchoClient.java:48)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0
(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run
(ExecuteJava.java:202)
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.execute
(ExecuteJava.java:134)
[java] at org.apache.tools.ant.taskdefs.Java.run
(Java.java:710)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava
(Java.java:178)
[java] at org.apache.tools.ant.taskdefs.Java.execute
(Java.java:84)
[java] at org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute
(Target.java:341)
[java] at org.apache.tools.ant.Target.performTasks
(Target.java:369)
[java] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[java] at org.apache.tools.ant.Project.executeTarget
(Project.java:1185)
[java] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:40)
[java] at org.apache.tools.ant.Project.executeTargets
(Project.java:1068)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[java] at org.apache.tools.ant.launch.Launcher.run
(Launcher.java:246)
[java] at org.apache.tools.ant.launch.Launcher.main
(Launcher.java:67)
(and the addressing module is included into the class path).
Michele
Michel Drescher wrote:
Hi Michele,
the easiest thing is to put the required modules (e.g.
addressing.mar) in the classpath, and create the
ConfigurationContext like this:
ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSyste
m( null, null );
But beware: You MUST NOT have any whitespaces in the class path!
The alternative is to have a fixed directory, e.g.:
ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSyste
m( "/axis2", null );
THe second step looks like this:
_serviceClient.engageModule( new QName
( org.apache.axis2.Constants.MODULE_ADDRESSING ) );
I have put this kind of code in my generated client stub for
convenience.
HTH,
Michel
On 21 Apr 2006, at 15:34, Michele Mazzucco wrote:
Hi Deepal,
could you explain me what do you mean in step 1?
Thanks,
Michele
Deepal Jayasinghe wrote:
You have to engage addressing module in the client if you are
trying to
invoke a service using dual channel. You can do that as follows
1 Create a ConfigurationContext using a repository witch
contains
addressing module in it
2. Then engage addressing module to ServiceCleint before
invoke the
service
(sc.engageModule(new QName("addressing")))
Michele Mazzucco wrote:
Hi all,
I've deployed Axis 2 (0.95) on Tomcat 5.5.15. I'm trying to
execute a
slightly modified version of the EchoNonBlockingDualClient
example,
but unfortunately it doesn't work.
The client throws the following exception
org.apache.axis2.AxisFault: In order to use two transport
channels,
WS-Addressing module must be engaged
but the "addressing" module is enabled in
%CATALINA_HOME%\webapps\axis2\WEB-INF\conf\axis2.xml (and in
fact,
according to the Axis 2 web administration tool, it seems to be
deployed).
Any suggestion is welcome.
Thanks in advance,
Michele