[WD16] Problem with .net vmware api

Startbeitrag von Michael am 09.11.2011 15:25

Hi everyone,

I'm trying to port this Example: Accessing Server-Side Inventory Objects to windev.

Current code looks like this:

sServer is string = "x.y.z"
sUser is string = "user"
sPass is string = "pass"

sServiceURL is string = "https://"; + sServer + "/sdk"

donetClient is object VimClient dynamic = new VimClient

// Connect to the vSphere web service.
donetClient:Connect(sServiceURL)

// Login with username/password credentials.
donetClient:Login(sUser,sPass)

// Get DiagnosticManager.
donetDiagMgr is object DiagnosticManager dynamic = donetClient:GetView(donetClient:ServiceContent:DiagnosticManager, Null)

// Obtain the last line of the logfile by setting an arbitrarily large line number as a starting point.
donetDiagMgrLogHdr is object DiagnosticManagerLogHeader dynamic = donetDiagMgr:BrowseDiagnosticLog(Null,"hostd",999999999,Null)
iLineEnd is int = donetDiagMgrLogHdr:LineEnd

// Get the last five lines of the log.
iStart is int = iLineEnd - 5
donetDiagMgrLogHdr = donetDiagMgr:BrowseDiagnosticLog(Null,"hostd",iStart,Null)

FOR EACH STRING sLine OF donetDiagMgrLogHdr:lineText
Trace(sLine)
END

// Logout from the vSphere server.
donetClient.Disconnect()

delete donetDiagMgr
delete donetDiagMgrLogHdr
delete donetClient


The BrowseDiagnosticLog says: No syntax of BrowseDiagnosticLog is compatible.

Any help is welcome - Thank you

Antworten:

Hi Michael,

Do you have an object definition for BrowseDiagnosticLog method?



von Jeff Graham - am 09.11.2011 22:32
Hello Jeff,

thank you for your reply.

Quote
Jeff Graham
Do you have an object definition for BrowseDiagnosticLog method?


The definition is found at http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.apiref.doc_50/vim.DiagnosticManager.html and defined as:

_this ManagedObjectReference
A reference to the DiagnosticManager used to make the method call.

host* ManagedObjectReference to a HostSystem
Specifies the host. If not specified, then it defaults to the default server. For example, if called on VirtualCenter, then the value defaults to VirtualCenter logs.

key xsd:string
A string key specifying the key for the log file to browse. Keys can be obtained using the queryDescriptions method.

start* xsd:int
The line number for the first entry to be returned. If the parameter is not specified, then the operation returns with lines starting from the top of the log.

lines* xsd:int
The number of lines to return. If not specified, then all lines are returned from the start value to the end of the file.

*Need not be set


If you open the assembly with WD you get:

// BrowseDiagnosticLog
//
// Parameters:
// host : ManagedObjectReference
// key : string
// start : Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
// lines : Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
// Return Value:
// DiagnosticManagerLogHeader

[ Result = ] BrowseDiagnosticLog (LOCAL host is ManagedObjectReference, LOCAL key is string, LOCAL start is Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], LOCAL lines is Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]])


Hope this helps

von Michael - am 10.11.2011 08:29
Hi Michael,
Interesting project !!!
What immediately comes in mind .. Due to fact that you have to deal with .xsd files it looks like you have to import a WSDL based WEBService. (including the xsd file(s), If I a am not completely wrong than you have to use the xsd types instead of plain WD types) See import xsd - on-line help.
---

Since you've mentioned VMWare.. Allow me to ask : Is your project about SaaS ??
For an upcoming (early next year) SaaS project I am evaluating several platform/tool options. What do you think about having a loosely coupled developer-exchange ?
My address is bizprac and I am living at orange.fr
Bjoern




von BLS - am 10.11.2011 16:42
I just hunkered down and purchased my first VM boxes -- mostly to create servers on the fly among the many other things that can be done w/ VSphere.

I'd be very interested too in a developer exchange too!

Thanks!
Georgio


von Georgio - am 10.11.2011 20:52
Quote
BLS
What immediately comes in mind .. Due to fact that you have to deal with .xsd files it looks like you have to import a WSDL based WEBService. (including the xsd file(s), If I a am not completely wrong than you have to use the xsd types instead of plain WD types) See import xsd - on-line help.

Thank you for your reply Bjoern. This pointed me to some SOAP directions - Thanks.
There is a vSphere Web Services SDK 4.1 Download available from VMware.
But this throws the next problem, as Windev won't allow me to import the WSDL.

Failure initializing the port 'VimPort'. The associated binding 'VimBinding' was not found.

I think they still have problems (even with WD16) to import "modern" WSDL structures.
The WDSL looks like this:

?xml version="1.0" encoding="UTF-8" ?
!--
Copyright 2005-2010 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


But there is also a .net-assembly included (see my first post) in VMware vSphere CLI. I still think that it should be posible to use the included assembly with Windev. Especially because everything works fine until BrowseDiagnosticLog.

Quote
BLS
Since you've mentioned VMWare.. Allow me to ask : Is your project about SaaS ??
For an upcoming (early next year) SaaS project I am evaluating several platform/tool options. What do you think about having a loosely coupled developer-exchange ?

Quote
Georgio
I'd be very interested too in a developer exchange too!

The best way to get me is by IRC (irc.progtech.net #WDEV). I'm living in UTC+1 (Germany). I'd be glad to have you on this channel.

von Michael - am 11.11.2011 11:36
Hi Michael,
Quote
Michael
I think they still have problems (even with WD16) to import "modern" WSDL structures.

Unfortunately that's true. Most probly you'll end up in importing the wsdl service using Visual Studio and create an assembly. (I have to do that for a healthcare/insurence related wsdl)

However :


port binding="interface:VimBinding" name="VimPort"
soap:address location="https://localhost/sdk/vimService"; /
/port


seems to be wrong. IMO this will only work iin case that the service is installed/running on your local machine. But well, I guess you have to fire up VS. Would be nice if you are willing to send a bug report to PCS.
Bjoern

von BLS - am 12.11.2011 10:24
Hi Bjoern,

there seems to be an example to work with the VMware VIX API in the LST 78 called "VIRTUALISATION VMWARE (WINDEV)".
But as far as I could figure out now, the VIX API is to manage and automate the OS guests inside your virtual machines. There is no function for i.e. creating a new VM.

I also found a sample at codeproject which looks very intuitive.
But again, no creation of new VMs or VMotion!.

If you want to use "the whole" thing you are stuck at the VMWare Virtual Infrastructure SDK.

Quote
BLS
Would be nice if you are willing to send a bug report to PCS.

I think this is the only chance. I'll keep you updated.

von Michael - am 12.11.2011 12:57
OK, See...
I hope to meet you on IRC within the next week. (ATM, I have to finish a WB16 job. which becomes a remarkable frustrating task 'cause of control-positioning, internal pages/controls, desktop + smart device support.) Nothing works as expected...

Anyway, maybe we can chat and/or start a teamviewer (remote desktop) session in order to figure out what's possible in VS / Import WSDL servive and generate code..... Let's see... :)

Indeed one question still remains : Are you examining SaaS infrastructure things, or "just" virtual server appliances ?

Bjoern

von BLS - am 12.11.2011 16:37
Quote
BLS
I hope to meet you on IRC within the next week. (ATM, I have to finish a WB16 job. which becomes a remarkable frustrating task 'cause of control-positioning, internal pages/controls, desktop + smart device support.) Nothing works as expected...

Anyway, maybe we can chat and/or start a teamviewer (remote desktop) session in order to figure out what's possible in VS / Import WSDL servive and generate code..... Let's see... :)

That would be awesome.
Quote
BLS
Indeed one question still remains : Are you examining SaaS infrastructure things, or "just" virtual server appliances ?

Yes and no. My company is a specialist in security related services for the internet. So we are also an ISP hosting "some" systems on fully redundant VMware based plattforms.
This is the reason why I'm currently evaluating some things that should make our job a bit easier by adding more automation.
But I think it'll be easier to discuss your SaaS-Project by IRC or even by fon. I'd be glad to assist you.

von Michael - am 13.11.2011 10:51
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.