To use the Java programming language to develop your applications and the .NET version is 4.0 or earlier on the Mirage Server, you must perform certain tasks to set up a Java development environment.

Procedure

  1. Open https://server-address:7443/mirageapi/MitService.svc?wsdl and export the certificate it.atco.com.cer.
  2. Run the command keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -noprompt -file it.atco.com.cer to import the certificate to the trusted store.
  3. Run the command wsdl2java.sh -uri https:// server-address:7443/MirageApi/MitService.svc?wsdl -p vmware.mirage.mit

    The source code folder src is created.

  4. Copy the source code to your Java project.

Results

With the generated classes, you can login to Mirage API. For example:

client = new MitServiceStub("https://server-address:7443/mirageapi/MitService.svc");
final SSLContext sslCtx = SSLContext.getInstance("TLS");
sslCtx.init(null, new TrustManager[] { new TrustAllTrustManager() }, null);
client._getServiceClient()
    .getOptions()
    .setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, new Protocol("https", (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslCtx), 7443));
final HttpState httpState = new HttpState();
client._getServiceClient().getOptions()
    .setProperty(org.apache.axis2.transport.http.HTTPConstants.CACHED_HTTP_STATE, httpState);
final Login login = new Login();
login.setUsername(“username”);
login.setPassword(“password”);
client.login(login);  
          
//Perform tasks