Add the required Axis libraries to your AXISCLASSPATHThis can be done as follows: Windows: set AXIS_HOME=c:\axis set AXIS_LIB=%AXIS_HOME%\lib set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar; %AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar; %AXIS_LIB%\log4j-1.2.8.jar;:%AXIS_LIB%\wsdl4j-1.5.1.jar Unix: export AXIS_HOME=/opt/java/axis-1_4/ export AXIS_LIB=$AXIS_HOME/lib export AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging-1.0.4.jar: $AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/wsdl4j-1.5.1.jar If you are using a version of Java earlier than 1.5 you may need to add xml-apis.jar and xercesImpl.jar to the Axis Classpath. Generating the actual Axis stub classesAssuming you have set up your AXISCLASSPATH as above, run the following command: java -cp "$AXISCLASSPATH" org.apache.axis.wsdl.WSDL2Java http://localhost:8095/crowd/services/SecurityServer?wsdl When the necessary objects are created off the Crowd server WSDL, you will end up with a directory structure similar to this: drwxr-xr-x 6 jstepka jstepka 204 Apr 19 16:56 SecurityServer_pkg drwxr-xr-x 3 jstepka jstepka 102 Apr 19 16:55 com drwxr-xr-x 4 jstepka jstepka 136 Apr 19 17:05 java Compiling the generated sourcesWhen you attempt to compile the generated class files, you will end up with a compilation error similar to the following: java/rmi/RemoteException.java:[10,7] cyclic inheritance involving java.rmi.RemoteException java/rmi/RemoteException.java:[11,32] modifier private not allowed here java/rmi/RemoteException.java:[12,29] modifier private not allowed here java/rmi/RemoteException.java:[64,29] modifier private not allowed here java/rmi/RemoteException.java:[86,20] modifier private not allowed here java/rmi/RemoteException.java:[104,56] modifier private static not allowed here com/atlassian/crowd/integration/exception/InvalidCredentialException.java:[26,30] incompatible types To resolve these compilation errors you will need to delete the generated java package and also remove all references to these custom RemoteException and Throwable exceptions in the stubs that Axis created. We highly recommend using an IDE for this as you will need to modify a number of classes. A small example of using the Axis-generated stubsThe security server can then be used as below:
// connect to the crowd server, using the supplied service URL, similar to http://localhost:8095/crowd/services/SecurityServer?wsdl
SecurityServerLocator secServer = new SecurityServerLocator();
secServer.setSecurityServerHttpPortEndpointAddress(secServer.getSecurityServerHttpPortAddress());
// obtain a reference to the SOAP service, which axis manages.
SecurityServerHttpBindingStub stub = null;
try
{
stub = (SecurityServerHttpBindingStub) secServer.getSecurityServerHttpPort();
// authenticate the integrated crowd application
AuthenticatedToken token = stub.authenticateApplication(new ApplicationAuthenticationContext(
new PasswordCredential("password", Boolean.FALSE), "demo",
new ValidationFactor[0]));
// do your custom calls here, eg:
SOAPPrincipal principal = new SOAPPrincipal();
principal.setName("test-user");
principal.setActive(Boolean.TRUE);
principal.setAttributes(new SOAPAttribute[]{
new SOAPAttribute("mail", new String[]{"test@example.com"}),
new SOAPAttribute("givenName", new String[]{"Paul"}),
new SOAPAttribute("sn", new String[]{"Smith"})
});
stub.addPrincipal(token, principal, new PasswordCredential("secret", Boolean.FALSE));
}
catch (Exception e)
{
System.err.print(e);
}
|
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 2.5 Australia License.

Comments (2)
Jun 16
Anonymous says:
Hi You don't actually explain how to compile 'the java classes' (I guess you me...Hi
You don't actually explain how to compile 'the java classes' (I guess you mean source files) or which source files to compile? So although the first steps work I now have some generated code but I don't know what to do with it. Perhaps a step by step for refactoring and compiling the generated code would be very useful here?
Thanks,
Shaun
Jun 18
Anonymous says:
In the end I copied both com/* and SecurityServer_pkg into a new maven proje...In the end I copied both com/* and SecurityServer_pkg into a new maven project and installed it as a jar and it worked fine. I used the following script to compile the axi stuff/wsdl (you will want to change the ip address of the server);
@echo off
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\wsdl4j-1.5.1.jar;C:\workspace\tools\maven_repo\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar\;C:\workspace\tools\maven_repo\xerces\xercesImpl\2.6.2\xercesImpl-2.6.2.jar
java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java http://1.1.1.1:8095/crowd/services/SecurityServer?wsdl
Add Comment