Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw an error if wsdl class map caching is enabled but cache is not writable #2

Merged
merged 18 commits into from
Sep 19, 2013

Conversation

rgrwkmn
Copy link

@rgrwkmn rgrwkmn commented May 16, 2013

The result I've had when this happens is a timeout because so much time is taken regenerating the class map over and over again. I think it's worth throwing an error since it's configured to cache and is not able to and it also reduces debugging time.

Roger Wakeman added 2 commits May 14, 2013 10:40
…he appropriate place to do this but I'm open to a better solution. Kinda feel like I was missing something since practically no SOAP requests will work without this. Also throw an exception if the class map is supposed to be cached but fails. If you're expecting this to be cached but directory permissions prevent it you are going to be wasting a lot of processing time generating it over and over again so it's good to get that feedback instead of debugging why your script is timing out. Maybe a warning would be more appropriate.
…mposer.json setup should take care of that.
@vadimcomanescu
Copy link
Owner

Hi. Sorry for the big delay I was out for a while. Indeed you need a little bit of setup to realise that TypeDefinitions.inc is required. A good composer.json configuration will do it. To understand better you mean the cache is not writable by the user that it's used to run php with, right?

@rgrwkmn
Copy link
Author

rgrwkmn commented May 21, 2013

Right. If you're using a server with unix style permissions it's not going to be able to write to that directory by default. There is no documentation about the wsdl class map cache so throwing an error if it can't write the file at least lets the developer know it's happening. I was getting a script execution timeout because it was taking so much time generating the class map over and over again and it took me a bit of debugging to figure out what was going on.

Also, you could consider adding the cache file to version control even if it's just blank at first. That way one can set the permissions on the file to be writable instead of the whole directory which doesn't need to be.

Can you share your composer.json? I can't just require the package, nothing gets autoloaded, I have to use force it to add all of the namespaces and classes into it's classmap like this:

"classmap": [
"vendor/vmwarephp/vmwarephp/library"
]

Other packages like Symphony load fine with just require.

Roger added 12 commits July 18, 2013 17:04
… the types of some structs like CustomizationFixedIp and CustomizationLinuxOptions. Anything that could be more than one type was being assumed as the default and then errors would ensue when the object had properties not present on the default.
…ss present that extends ManagedObject for that specific type of ManagedObject. It just needs to be of the same type that we are looking for.
…nda ugly right now, could probably make another class for doing this kind of stuff.
…hild entities by name and traversing descendant folders.
…o you can optionally automatically create folders you are looking for if they don't exist.
…ct method beginning with 'Get' from being called. Now it only considers a method to be property retrieval if it begins with 'get'
…r ManagedObject and the functionality is already covered by getReferenceId
…me it needs to connect, Service now will use SessionManager->AcquireCloneTicket and SessionManager->CloneSession to reuse an existing session if possible.
@rgrwkmn
Copy link
Author

rgrwkmn commented Aug 27, 2013

I'm just bombarding you with all the commits I've made. Let me know if there is anything you want changed, I can make a new branch, remove whatever changes you don't want and then send a pull request on that.

90e3baa - a pretty important bug fix if you need to use some ambiguous customization types
ee2192a - you already fixed this in your branch, I merged those changes in 4955f7a
53aded0 - could use a little more work but has been extremely valuable in showing more info when a SoapFault is thrown
bee1f99 - Folder Extension for easily traversing Folders
b4f20df - bug fix for ManagedObject methods starting with Get
e6fe7b8 - clone sessions if possible instead of authenticating each time

Roger added 4 commits September 11, 2013 10:58
…icts with a Service->isMethodAPropertyRetrieval. Essentially, getConfig was already a method of VirtualMachine because it starts with 'get'. For some reason if I add getConfig literally onto VirtualMachine it always returns null.
vadimcomanescu added a commit that referenced this pull request Sep 19, 2013
Throw an error if wsdl class map caching is enabled but cache is not writable
@vadimcomanescu vadimcomanescu merged commit 6d302b0 into vadimcomanescu:master Sep 19, 2013
@vadimcomanescu
Copy link
Owner

I just made a few refactoring by extracting a new exception for detailed messages and introduce the session manager as an extension to handle the clone tickets. I think it's more clear like this. Thanks a lot for all the changes. Really nice work.

@rgrwkmn
Copy link
Author

rgrwkmn commented Sep 24, 2013

Very nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants