The pattern (the same in any language kit, but some may abstract some of the lower-level details) is the following - gom_mor = RetrieveServiceContent().guestOperationsManager // Some language...
See more...
The pattern (the same in any language kit, but some may abstract some of the lower-level details) is the following - gom_mor = RetrieveServiceContent().guestOperationsManager // Some language kits require you instantiate a GuestOperationsManager object using the managed object reference provided by ServiceContent (gom) gomfm = gom.fileManager // This returns another moref, again some language kits handle it differently and you may not need to instantiate the object (fetch it's properties) auth = new NamePasswordAuthentication() // subclass of GuestAuth object auth.username = "username" auth.password = "password" auth.interactiveSession = false // usually false, basically should it initialize a user environment for the process gomfm.auth = auth moref = virtualmachineMoRef // have to get this by querying the vCenter inventory guestFilePath = "c:/coolfile.txt" fileAttributes = new GuestFileAttributes() // use default or set appropriately fileSize = coolfile_bytes // important, this determines the buffer when you submit the PUT request later for the transfer overwrite = false // who would ever want to overwite coolfile? put_url = InitiateFileTransferToGuest(gomfm, moref, guestFilePath, fileAttributes, fileSize, overwrite) // most language kits add this function to the gomfm itself so -- put_url = gomfm.InitiateFileTransferToGuest(moref, guestFilePath, fileAttributes, fileSize, overwrite) Then you have to do an HTTP PUT request to that put_url, set your content-length header to the bytes you set in fileSize. Similarly with the content-type. Your language may have a simple PUT library that does it all for you of course, William used Perl's LWP to do the PUT. You probably are having issues b/c you technically need to get contents of GuestOperationsManager to get the GuestFileManager, AuthManager, etc. You can't just jump to GuestFileManager, you need the MOREF value you get from the GuestOperationsManager.guestFileManager for the InitiateFileTransferToGuest(). What language kit are you using for your project?