Java Vault Client

Sometimes I want to write a program something just for the sake of doing it.  So I decided to write a simple Java client for Vault.  As you may already know, Vault communicates over HTTP using SOAP, which means you can write a client in just about any language and platform that you want. 

The program itself is pretty basic.  It's just a Java port of the VaultList SDK sample, which just lists all the files in the Vault.

Click here to download the application
Click here to download the source

What you need:
Vault 2010 (any version)
Java
Axis 1.4

To run:

  1. Download VaultListJava
  2. Create a "lib" subfolder
  3. Download Axis 1.4 (axis-bin-1_4.zip)
  4. Unzip the file.
  5. Copy the lib directory contents to the lib directory under VaultListJava
  6. Execute VaultListJava.jar

For programmers:
If you are a member of the Autodesk Developer Network, you should read Tutorial: Using Java to Access the Vault API, which is the definitive guide to writing Java clients for Vault.  Although it was written for Vault 5, it's still valid for Vault 2010.

I tried using some of the newer Java tools for web services, but I was not able to get them to work properly with Vault.  The problem was getting control of the security header, which needs to be copied from the SecurityService to all the other services.  Axis 1.4 gave me the ability to do that, but  I was not able to find a way with JAX-WS or Axis 2.  Of course, my Java is very rusty, so maybe I just missed how to do it.


Comments

5 responses to “Java Vault Client”

  1. hi doug,
    Great post, do you have any example of accessing vault using http post/get method? I try to get a list of available vault, I go here http://localhost/AutodeskDM/Services/KnowledgeVaultService.asmx/GetAllKnowledgeVaults
    and click invoke but it returns error
    Connectivity.Core.Exceptions.CoreException: TransactionInvalidPrincipal [106]
    I also tried to use javascript post method but this is the response i get
    Failed to load resource: the server responded with a status of 500 (Internal Server Error)

  2. Sorry but you can’t invoke Vault API functions in that way. Our security framework prevents it from happening.

  3. i see, then i guess i’ll have to learn how to use soap with javascript.

  4. For some reason I’m trying to do the same thing in PHP and I get a tag around my security header values http://pastebin.ca/2045558 (php code) and here is the request and response: http://pastebin.ca/2045560

  5. Gordon Luckett Avatar
    Gordon Luckett

    Did you ever get PHP running with the SOAP etc code? I would love just to be able to connect to Vault with PHP…

Leave a Reply to Michael SpearsCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading