VMware {code} Community
aswani521
Contributor
Contributor

Building the samples in sdk

I am trying to build the sdk.

I had installed VS 2005. I had set the %SDKHOME% to my SDK directory and I had set my %WSDLFILE% to %SDKHOME%\wsdl

C:\Documents and Settings\vknerell\Desktop\VMware\VSphere SDk\sdk\SDK\samples\DotNet\cs\SimpleClient\bin\Debug>echo %WSDLFILE%

C:\Documents and Settings\vknerell\Desktop\VMware\VSphere SDk\sdk\SDK\wsdl

when I execute the build2005 command from sdk command prompt. I am getting the following output of errors:

C:\Documents and Settings\vknerell\Desktop\VMware\VSphere SDk\sdk\SDK\samples\DotNet>Build2005

Visual Studio 2005 is installed

Setting Path

Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified

Please specify WSDL files to generate stubs for

The system cannot find the file specified.

E.g.

genvimstubs.cmd .\

Or to customize namespace stubfilename and dll names etc...

genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs

ECHO is off.

Error: No Visual Studio 2005 environment settings found

Please run this script inside a Visual Studio 2005 Command Prompt

ECHO is off.

Stub generation Failed!

ECHO is off.

Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified

Please specify WSDL files to generate stubs for

The system cannot find the file specified.

E.g.

genvimstubs.cmd .\

Or to customize namespace stubfilename and dll names etc...

genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs

ECHO is off.

Error: No Visual Studio 2005 environment settings found

Please run this script inside a Visual Studio 2005 Command Prompt

ECHO is off.

Stub generation Failed!

ECHO is off.

Building Samples in Debug mode

Done Building optimized Stubs and all Samples

The WSDL path has been set properly but why doesn't it find those files?

can somebody help me ?

Reply
0 Kudos
17 Replies
jeffpurcell
Enthusiast
Enthusiast

I had a similar issue.

Probably not getting set in your environment properly.

I found that if you hard code the entries using the Computer "System Properties" -> "Advanced settings" --> environment variables it worked fine for.

I.e. define SDKHOME and WSDLFILE paths within the envionment settings.

You can verify that the variables are set properly with cd %SDKHOME% and %WSDLFILE%

hth.

Reply
0 Kudos
aswani521
Contributor
Contributor

i hard coded the entries for WSDLFILE & SDKHOME but the still i get the same error message.

I had set these variables as system environment variables.

Is there anything I am missing ?

I checked the by cd %WSDLHOME% and %sdkhome% they worked fine.

C:\>cd %wsdlfile%

C:\Documents and Settings\vknerell\Desktop\VMware\VSphere SDk\sdk\SDK\wsdl>

C:\>cd %sdkhome%

C:\Documents and Settings\vknerell\Desktop\VMware\VSphere SDk\sdk\SDK>

Reply
0 Kudos
jeffpurcell
Enthusiast
Enthusiast

I would suggest that you simplify your environment by moving the SDK folder and code to a location such as C:\visdk

Set you environment in a similar way to what you described in your last post.

%SDKHOME% = C:\visdk\SDK

%WSDLFILE% = C:\visdk\SDK\wsdlfile

Launch the VS2005 command prompt console

Type the "Set" command to verify that the correct paths are included in the output.

Change directory to C:\visdk\SDK\samples\DotNet.

Launch the Build2005 file.

aswani521
Contributor
Contributor

hey thank you very much. That worked.

I still do not understand, why a longer path is affecting the environment variables.

Reply
0 Kudos
kelliw
Contributor
Contributor

The "longer path" has spaces in it ("Documents and Settings\..."), which frankly, never seem to work very well in path names. As Jeff suggests, simplifying the path works. BTW, ou'll notice that the examples in the Developer's Setup Guide start from the c:\, as in C:\devprojects\visdk21\SDK\samples\DotNet>build2005.

Reply
0 Kudos
xiaoa
Contributor
Contributor

i have set this in environment variable

WSDLFILE = C:\SDK\wsdl\vim25

SDKHOME = C:\SDK

(Launch the VS2005 command prompt console

Type the "Set" command to verify that the correct paths are included in the output.

Change directory to C:\SDK\samples\DotNet.

Launch the Build2005 file. )

still get the same error

Visual Studio 2005 is installed

Setting Path

Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified

Please specify WSDL files to generate stubs for

The system cannot find the file specified.

E.g.

genvimstubs.cmd .\

Or to customize namespace stubfilename and dll names etc...

genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs

ECHO is off.

Error: No Visual Studio 2005 environment settings found

Please run this script inside a Visual Studio 2005 Command Prompt

ECHO is off.

Stub generation Failed!

ECHO is off.

Error: Directory for WSDL files vim.wsdl and vimService.wsdl not specified

Please specify WSDL files to generate stubs for

The system cannot find the file specified.

E.g.

genvimstubs.cmd .\

Or to customize namespace stubfilename and dll names etc...

genvimstubs.cmd .\ VimApi .\stubdir MyVimStubs.cs .\dlldir MyVimStubs

ECHO is off.

Error: No Visual Studio 2005 environment settings found

Please run this script inside a Visual Studio 2005 Command Prompt

ECHO is off.

Stub generation Failed!

ECHO is off.

Building Samples in Debug mode

Done Building optimized Stubs and all Samples

any other way to solve it ? @.@

Reply
0 Kudos
admin
Immortal
Immortal

As mentioned in the previous replies, try setting the system variable WSDLFILE to C:\SDK\wsdl instead of C:\SDK\wsdl\vim25. I think it should work.

Reply
0 Kudos
xiaoa
Contributor
Contributor

thanks. i got it sucessfully working but right now i have problem running the simpleclient application

c:\sdk\samples\DotNet\cs\SimpleClient\bin\Debug

after that i try to run the application it does not work it show

C:\SDK\samples\DotNet\cs\SimpleClient\bin\Debug>simpleclient

Usage : SimpleClient <webserviceurl> <username> <password>

Caught Exception : Name : IndexOutOfRangeException Message : Index was outside

the bounds of the array. Trace : at SimpleClient.SimpleClient.Main(String[] a

rgs) in C:\SDK\samples\DotNet\cs\SimpleClient\SimpleClient.cs:line 249

what the problem and how to solve it ? thanks

Reply
0 Kudos
heyitspablo
VMware Employee
VMware Employee

Im going to ask our docs team to see if we can improve on this.. in the interim Angela from our esteemed SDK Dev Support team looks like she is providing some answers..

regards,

Pablo

Keep up with latest info on vSphere PowerCLI http://blogs.vmware.com/vipowershell - Follow me on Twitter @heyitspablo
Reply
0 Kudos
admin
Immortal
Immortal

The SimpleClient.cs sample connects to the ESX / vCenter Server and retreives the container contents starting from the root folder. As mentioned in the vSphere Developers Setup Guide page 22, to run the sample SimpleClient , you need to pass the command line parameters namely, the web service URL to connect to ( i.e. the server's IP address), the username and password for that server.

C:\SDK\samples\DotNet\cs\SimpleClient\bin\Debug>simpleclient IP address>/sdk <username> <password>

Please follow the above steps to run the sample and let us know if you have any further queries for the same.

Reply
0 Kudos
xiaoa
Contributor
Contributor

thanks. the above solution have help me.

i get this message

There were one or more problems with the server certificate:

  • A certification chain processed correctly, but terminated in a root certifica

e which isn't trusted by the trust provider.

  • The certificate's CN name does not match the passed value.

does this affect anything of it ?

Reply
0 Kudos
admin
Immortal
Immortal

As you are trying to connect over a secure channel (https), this message is just prompted as a warning.

Are you able to run the Sample successfully or do you get error messae i.e. were you able to see the container contents inside the Server, to which you are trying to connect, as the ouput when you ran the SimpleClient.cs sample?

Reply
0 Kudos
xiaoa
Contributor
Contributor

Yes, i am able to see the output. Thanks.

IF i wan to use the CreateVM inside the C:\SDK\samples\DotNet\cs\VMCreate how to i run it ? is it using the same method as above ?

Reply
0 Kudos
admin
Immortal
Immortal

The documentation specifying how to rum VMCreate.cs sample is missing. To run this sample, the required parameters are web service URL, username, passsword, the name of the VM and the datacenter on which you want to create the VM. You can specify other optional parameters like host name, disk size etc in order to customize your VM. So, the command would look like this:

C:\SDK\samples\DotNet\cs\VMCreate ip address>/sdk <username> <password> <datacenter name> <VM name>

For future references on how to run a sample, please refer to the class OptionSpec which can be found under AppUtil. This class initializes the command line parameters that you pass to run a sample. You can refer to the way the parameters are passed in the OptionSpec in VMCreate sample and identify which are required and which are optional.( If required = 1 --> required parameter and if required=0 --> optional parameter)

Also, you can refer to the corressponding Java samples to see the description for the command line parameters for the specific C# sample.

P.S. - The web service URL, username and password command line parameters are required to run any sample.

Hope this helps.

Reply
0 Kudos
xiaoa
Contributor
Contributor

i have this C# program how do i program it to connect to the server ? to create vm delete on off vm.

server ip address 172.16.242.161

user: georget

ps: password

Reply
0 Kudos
admin
Immortal
Immortal

To run the CreateVM script, please refer the below command line:

CreateVM.cs IP address>/sdk <username> <password> <datacenter name> <IP address of the host> <name of the VM>

The description for the same is also provided in the script as well.

For power on/off operations on a VM, please refer to PowerOnVM_Task/PowerOffVM_Task methods in the vSphere API reference guide.

http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html

For furture posts, please post a new thread for a different query/issue and avoid posting questions for different queries in a single forum thread. This would be helpful for the other users in the forums to locate a specfic issue by refering to the subject line of the posted forum threads.

Reply
0 Kudos
webwarrior
Contributor
Contributor

Getting the following error when running the CIMInfo application:

"<f:WSManFault xmlns:f=\"http://schemas.microsoft.com/wbem/wsman/1/wsmanfault\" Code=\"2150859023\" Machine=\"bb006264.saabsystems.com.au\"><f:Message>The WinRM client received an HTTP status code of 504 from the remote WS-Management service. </f:Message></f:WSManFault>"

The Simple Client sample works fine.

What could possbly be the problem.

I can also sucessfully navigate the Fan object using cimnavigator, of which the developer refuses to release the source code for free.

I am stuck between a rock and a hard place, and we are about to give up on VMWare.

When browsing to the web service at http://serveripaddress/sdk/vimService?wsdl

I get the following:

  <?xml version="1.0" encoding="UTF-8" ?>
<!--
   Copyright 2005-2009 VMware, Inc.  All rights reserved.
  -->
- <definitions targetNamespace="urn:vim25Service" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:interface="urn:vim25">
  <import location="vim.wsdl" namespace="urn:vim25" />
- <service name="VimService">
- <port binding="interface:VimBinding" name="VimPort">
  <soap:address location="https://localhost/sdk/vimService" />
  </port>
  </service>
  </definitions>

Is the localhost bit supposed to be in there?

Shaun O'Reilly

Reply
0 Kudos