Hi

I need some help with the client-side programming of
Axis2SampleDocLit.wsdl. I am supposed to teach this subject on Wednesday
and have still problems running the client applications.

Here are the 7 points that may help explain my problem:

1. I have used WSDL2Java to generate both the server-side and
client-side code
2. I have implemented the methods in the Skeleton class and implemented
a TestClient.java class that uses the Stub class (according to the
userguide of axis2)
3. I have ran "ant" on the build.xml file that wsdl2Java generated for me
4. "ant" generates the "build" directory with many usefull
subdirectories, in one of them, I found the .AAR file for the
server-side, and this file is now deployed
5. Here I run into problems, I don't know how to run my client, I
suppose that, since "ant" is successfull and the class file
(TestClient.class) of my TestClient.java is present under
org/apache/axis2/userguide, there is no compilation problem
5.1 Here is the code of my TestClient.java, which should be right (since
I use -d xmlbeans option of WSDL2java)

package org.apache.axis2.userguide;

import org.apache.axis2.userguide.*;
import org.apache.axis2.userguide.xsd.*;

public class MyClient
{

public static void main(String []args){
   System.out.println("We are in Main of MyClient!");
   try {
    //Create the stub by passing the AXIS_HOME and target EPR.
    //We pass null to the AXIS_HOME and hence the stub will use the
current directory as the AXIS_HOME
    Axis2SampleDocLitServiceStub stub= new
Axis2SampleDocLitServiceStub(null,

"http://localhost:8080/axis2/services/Axis2SampleDocLitService";);
    //Create the request document to be sent.
   EchoStringParamDocument  reqDoc=
EchoStringParamDocument.Factory.newInstance();
   reqDoc.setEchoStringParam("Axis2 Echo");
   //invokes the Web service.
   EchoStringReturnDocument resDoc=stub.echoString(reqDoc);
   System.out.println(resDoc.getEchoStringReturn());
   } catch (Exception e) {
       e.printStackTrace();
   }
 }
}

6. But, whenever I try to run TestClient, I get the error:
java  TestClient
Exception in thread "main" java.lang.NoClassDefFoundError: TestClient
(wrong name
: org/apache/axis2/userguide/TestClient)
       at java.lang.ClassLoader.defineClass1(Native Method)
       at java.lang.ClassLoader.defineClass(Unknown Source)
       at java.security.SecureClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.access$100(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClassInternal(Unknown Source)

7. When I use the package-name like this, I get:

D:\PhD\MOD250-JWS\axis2-bin\samples\myServiceClient2\build\classes\org\apache\ax
is2\userguide>java org.apache.axis2.userguide.TestClient
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/axis2/user
guide/TestClient

8. I am  at the right directory and the file is there
.
D:\PhD\MOD250-JWS\axis2-bin\samples\myServiceClient2\build\classes\org\apache\ax
is2\userguide>is2\userguide>dir
Volumet i stasjon D er Lokal Disk
Volumserienummeret er DA91-10E8

Innhold i
D:\PhD\MOD250-JWS\axis2-bin\samples\myServiceClient2\build\classes\or
g\apache\axis2\userguide

14.11.2006  03:13    <DIR>          .
14.11.2006  03:13    <DIR>          ..
13.11.2006  17:47             1 521
Axis2SampleDocLitServiceCallbackHandler.class
13.11.2006  17:47             2 274 Axis2SampleDocLitServiceStub$1.class
13.11.2006  17:47             2 244 Axis2SampleDocLitServiceStub$2.class
13.11.2006  17:47             2 244 Axis2SampleDocLitServiceStub$3.class
13.11.2006  17:47            21 733 Axis2SampleDocLitServiceStub.class
14.11.2006  01:24               581 MyClient2.class
14.11.2006  02:15               511 TestClient.bat
13.11.2006  21:30             1 778 TestClient.class
13.11.2006  17:47    <DIR>          xsd
              8 fil(er)           32 886 byte
              3 mappe(r)  22 988 181 504 byte ledig


Best regards

Adrian


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to