Run a Sample Application Using the Provided Scripts in the Web Services SDK

You can use the run.bat or run.sh script to run any of the Java samples. The SimpleClient sample is a good choice to verify that your installation is correct. The path to the source file for SimpleClient is:

%WS_SDK_HOME%\java\JAXWS\samples\com\vmware\general\SimpleClient.java

When you run the script, specify the Java class for the sample application along with the --url, --username, and --password switches on the command line. Include the complete package name in the Java class specification. The following statement shows the general format for using the run.bat script to run the SimpleClient sample application from the Java samples subdirectory for JAX-WS:

run.bat com.vmware.general.SimpleClient --url https://yourFQDNservername/sdk 
                   --username username --password password [--ignorecert ignorecert]

The following example shows sample output from the SimpleClient sample program.

Sample Output of a Successful Run of SimpleClient, Using Precompiled Java Sample

Object Type : Folder
Reference Value : ha-folder-vm
   Property Name : name
   Property Value : vm
Object Type : HostSystem
Reference Value : ha-host
   Property Name : name
   Property Value : sdkpubslab-02.eng.vmware.com
Object Type : ResourcePool
Reference Value : ha-root-pool
   Property Name : name
   Property Value : Resources
Object Type : Folder
Reference Value : ha-folder-host
   Property Name : name
   Property Value : host
Object Type : ComputeResource
Reference Value : ha-compute-res
   Property Name : name
   Property Value : sdkpubslab-02.eng.vmware.com
Object Type : VirtualMachine
Reference Value : 16
   Property Name : name
   Property Value : Windows_2K3_VM
...
Object Type : Datacenter
Reference Value : ha-datacenter
   Property Name : name
   Property Value : ha-datacenter
Object Type : Folder
Reference Value : ha-folder-root
   Property Name : name
   Property Value : ha-folder-root

To run the precompiled SimpleClient from the command prompt, do the following procedure.

Procedure

  1. Open a Windows command prompt or shell prompt on Linux.
  2. Navigate to the Java samples subdirectory.
    cd %WS_SDK_HOME%\java\JAXWS\samples
  3. Invoke the Java runtime, providing the full package name of the SimpleClient, server URN, credentials, and Java keyStore location, or the --ignorecert argument. The complete syntax is as follows:
    java -Djavax.net.ssl.trustStore=keystore-path-or-%KEYSTORE%-environment-variable 
             package-hierarchy-classname --url server-url --username username 
             --password password [--ignorecert ignorecert]

    For example:

    java -Djavax.net.ssl.trustStore=%VMKEYSTORE% com.vmware.general.SimpleClient 
             --url https://example.com/sdk --username pubs --password ***
             --ignorecert ignorecert
    Note:

    If error messages occur due to system heap or other memory problems, you can give the Java VM more memory, as follows:

    java -Djavax.net.ssl.trustStore=%VMKEYSTORE% -Xms512M -Xmx1024M 
            com.vmware.general.SimpleClient https://sdkpubslab-02.eng.vmware.com/sdk 
            --username username 
            --password password --ignorecert ignorecert