Last updated Dec 8, 2017

Axis 1.x Client Stub generation

SOAP API is no longer available

SOAP API has been removed in Crowd 5.0. For information on how to migrate to REST API, see Crowd SOAP to REST migration guide.

### Add the required Axis libraries to your AXISCLASSPATH

This can be done as follows:

Windows:

1
2
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:

1
2
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 classes

Assuming you have set up your AXISCLASSPATH as above, run the following command:

1
2
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:

1
2
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 sources

When you attempt to compile the generated class files, you will end up with a compilation error similar to the following:

1
2
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 stubs

The security server can then be used as below:

1
2
// 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);
}

Rate this page: