VMware
 

Knowledge Base

Search the Knowledge Base:

Products:
Search In:
 

Using the VIPerl Toolkit Web Services Debug Utility

Details

I am writing SOAP messages for my Web services and I am using the VMware Infrastructure Perl Toolkit. Are there any tools or utilities available to help me debug my code?

Solution

This KB describes how to use the VIPerl Toolkit debug utility. This utility is provided to help developers identify potential errors in their Web services SOAP messages.

To use VIPerl Toolkit debug utility:

1. Install VI Perl Toolkit. Refer the following link for information on installing the VI Perl Toolkit:

http://www.vmware.com/support/developer/viperltoolkit/doc/perl_toolkit_install_idx.html

2. Copy the script debugutility.pl to your VI Perl Toolkit directory. For example:

C:\Program Files\VMware\VMware VI Perl Toolkit\Perl\samples

3. Open the debugtility.pl file using a text editor.

4. Add your source code to the debugutility.pl file.

Place your source code within the designated eval function. The designated area is highlighted with comment text as follows:

eval {

## Insert your code here - after eval { and before end of eval ie. };########

###### End of Code Inserted ###################################

};

5. Save and close the debugutility.pl file.

When you execute the utility, you provide any parameters required to run this code at the command prompt. The command line arguments are then parsed to generate a dynamic hash map.

6. Navigate to C:\Program Files\VMware\VMware VI Perl Toolkit\Perl\samples .

7. Open a command prompt and enter the following:

> perl debugutility.pl --username <user> --password <mypassword>

--url https://<ipaddress>:<port>/sdk/webService

--sampleParam1 <Value> --sampleParamN <Value>

where – sampleParams are any parameters the code you inserted in the blank eval function requires to run.

NOTE: In addition to the steps listed here, refer to the help comments provided in the attached debugutility.pl script and the test cases provided below for additional information.
 

Sample Test Cases

 

Setup

Command

Result

Test Case P_debugutility_1

Run the debug utility, without your source code inserted, while connected to an ESX Server.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService

 

The debug utility displays the environment information of the host:

·        Host Name

·        Host Version

·        Devices connected to the host.

·        List of virtual machines and the guest os running on each virtual machine.

The information is saved in a system information file.

Test Case P_debugutility_2

Run the debug utility, without your source code inserted, while connected to a VirtualCenter server.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService

The debug utility displays:

·        Number of hosts connected to the VirtualCenter server.

·        VirtualCenter version

·        The environment information of all the hosts

o       Host Name

o       Host Version

o       Devices connected to the host

o       List of virtual machines and the guest os running on each virtual machine

The information is saved in a system information file.

Test Case P_debugutility_3

Run the debug utility, with your source code inserted in the designated blank eval function.

 

All the parameters needed for executing the inserted code need to be provided at the command prompt.

 

If no exception is generated by the function, the utility stops upon completing the execution.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService --sampleparam dummy1 --sampleparam2 dummy2

The debug utility:

·        Executes the inserted code.

·        Displays and saves all the environment information in a system information file.

·        Displays a message "Code executed successfully".

Test Case P_debugutility_4

Run the debug utility, with your source code inserted, on an ESX Server.

 

All the parameters needed for executing the inserted code need to be provided at the command prompt.

 

An exception is generated by the function, and the utility handles the exception

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService --sampleparam dummy1 --sampleparam2 dummy2

Whenever an exception is encountered, the debug utility performs the following:

·        Displays and saves all the environment information in a system information file.

·        Displays the exception encountered.

·        Records the last log line for the connected hosts and extracts the modified log content upon execution of the blank eval function. For each connected host, a log is saved as <hostname>.log.

·        Generates log bundles and saves them as "logbundles" files.

Test Case P_debugutility_5

Run the debug utility, with your source code inserted, on a VirtualCenter server.

 

All the parameters needed for executing the inserted code need to be provided at the command prompt.

 

If no exception is generated by the function, the utility stops upon completing the execution.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService

Whenever an exception is encountered, the debug utility performs the following:

·        Displays and saves all the environment information in a system information file.

·        Displays the exception encountered.

·        Records the last log line for the connected hosts and extracts the modified log content upon execution of the blank eval function. For each connected host, a log is saved as <hostname>.log.

·        Generates log bundles and saves them as "logbundles" files.

Test Case P_debugutility_6

Run the debug utility, with your source code inserted, on a VirtualCenter server.

 

All the parameters needed for executing the inserted code need to be provided at the command prompt.

 

If the utility is interrupted by user or the inserted code creates an infinite behavior. The utility handles the error as an exception.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService

Whenever an exception is encountered, the debug utility performs the following:

·        Displays and saves all the environment information in a system information file.

·        Displays the exception encountered.

·        Records the last log line for the connected hosts and extracts the modified log content upon execution of the blank eval function. For each connected host, a log is saved as <hostname>.log.

·        Generates log bundles and saves them as "logbundles" files.

Test Case N_debugutility_1

Run the debug utility, with your source code inserted, on a VirtualCenter server.

 

Do not provide all the parameters needed for executing the inserted code.

 

A fault is generated. The utility handles error as an exception.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService

Whenever an exception is encountered, the debug utility performs the following:

·        Displays and saves all the environment information in a system information file.

·        Displays the exception encountered.

·        Records the last log line for the connected hosts and extracts the modified log content upon execution of the blank eval function. For each connected host, a log is saved as <hostname>.log.

·        Generates log bundles and saves them as "logbundles" files.

Test Case N_debugutility_2

Run the debug utility, with your source code inserted, on a VirtualCenter server.

 

Do not precede all parameters needed for executing the inserted code with a dash (-) or double-dash (--).

 

The parameters missing the dash or double-dash are not recognized as parameters. They are not available for the inserted code through the get-option.

 

If the parameters are required to complete the execution of the inserted code, a fault is generated. The utility handles the error as an exception.

perl debugutility.pl --username administrator --password mypassword --url https://<ipaddress>:<port>/sdk/webService -sampleparam1 dummy1 sampleparam2 dummy2

Whenever an exception is encountered, the debug utility performs the following:

·        Displays and saves all the environment information in a system information file.

·        Displays the exception encountered.

·        Records the last log line for the connected hosts and extracts the modified log content upon execution of the blank eval function. For each connected host, a log is saved as <hostname>.log.

·        Generates log bundles and saves them as "logbundles" files.

Keywords

SDK, Virtual Center, ESX

Attachments

Feedback

Rating: 1 - Lowest 2 3 4 5 - Highest (5 Ratings)   

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (2000 or fewer characters)
Submit
Rating: 1 - Lowest 2 3 4 5 - Highest (5 Ratings)   
Actions