If you have looked at the code for the SDK or blog samples, you probably noticed a class called ServiceManager, which acts as a factory for creating service objects. It's very useful for things like setting the URL and security information each time a service object is created.
The only problem is that no two ServiceManagers are the same. I would end up coping it from project to project. Then I would modify it for that specific app. For example, some apps would have GetItemService while other would now. Some Service managers allowed multiple logins while others assumed a single login.
So, I decided to create a single ServiceManager that could be used with any app without the need for modification. I put in in a separate DLL called JustOnesAndZeros.WebServices.dll and added it to my Effective Folder Permissions 2.0 and Watch Folder samples.
- A single function, GetService() works for all web services classes in the Vault API.
- Manages the security context for all services it creates.
- Recognizes VaultContext objects from the Vault Client or Job Processor APIs.
- Can handle multiple simultaneous logins.
|Note: I titled the DLL after my blog, not after my company. I deliberately avoided using the word "Autodesk" to make it clear that this is my own set of utilities and the contents of the DLL are not part of the official Vault SDK.|
Feel free to use ServiceManager or any other items from JustOnesAndZeros.WebServices.dll. But I recommend copying the code into your project instead of linking to the DLL. I will be constantly updating the DLL as new samples come out. So it's not a very stable thing to link to.