Vault API login using Java

Vault API login using Java

Anonymous
Not applicable
1,475 Views
4 Replies
Message 1 of 5

Vault API login using Java

Anonymous
Not applicable

Hello,


We are dealing with the same issue as http://forums.autodesk.com/t5/vault-customization/can-t-connect-to-vault-using-api/m-p/5789804/highl... except that we have always used Java (and unfortunately, this can't change).

 

Our old code signed in to Vault using the SecurityService and setting the SoapEndpoint address, then creating a security header with the results of our signin call using the specific vault/user information.

 

           SecurityServiceLocator loc = new SecurityServiceLocator();
            loc.setSecurityServiceSoapEndpointAddress("http://" + vaultServer + "/autodeskDM/Services/SecurityService.asmx");
            SecurityServiceSoapStub port = (SecurityServiceSoapStub)loc.getSecurityServiceSoap();

           port.signIn(userName, password, vaultName)


            SOAPHeaderElement soapHead = port.getResponseHeader("http://AutodeskDM/Services/Security/1/22/2015/", "SecurityHeader");
            NodeList secNodes = soapHead.getChildNodes();
            String ticket = null;
            long userId = -1;
            for (int i=0; i<secNodes.getLength(); i++)
            {
                Node n = secNodes.item(i);
                String nodeName = n.getNodeName();
                if (nodeName != null && nodeName.equals("Ticket"))
                {
                    ticket = n.getFirstChild().getNodeValue();
                }else if (nodeName != null && nodeName.equals("UserId"))
                {
                    String userIdString = n.getFirstChild().getNodeValue();
                    userId = Long.parseLong(userIdString);
                }
            }
            securityHeader = new SecurityHeader(ticket, userId);

 

We now need to update to the Vault 2016 API and have to update or rewrite the code.   All help references I can find are for .NET, c#, VB etc. and seem to reference WebServicesTools classes that I cannot find.  Note: we use a wsdl to java class generator to get all the classes for WebServices.

 

My hope is that once I have WebServicesTools I can get the WebServiceManager or UserPasswordCredentials classes.  Is this the right approach? Where do I find those?  Any other ideas?

 

Thanks in advance!

0 Likes
1,476 Views
4 Replies
Replies (4)
Message 2 of 5

minkd
Alumni
Alumni

If you are generating Java classes from the WSDLs you will not have the WebServiceManager or UserPasswordCredentials classes.  The reason is because those classes are not part of the web-service API - they are part of a C#/.NET client-side SDK which wraps all the C# classes that we generated from the WSDL. In the process of creating the C#/.NET client-side SDK from the web-service WDSLs, many things were added that are not part of the web-service API (dealing with the security header, automatic re-signin, automatic ownership transfer, etc).

 

Later we created another layer on top of the SDK called the VDF (also a C#/.NET library).  The VDF can do things such as fixing up the references between files after downloading a file whose children have been renamed or moved in the vault.

 

While it is still possible to call the web-service API directly, doing so excludes you from being able to take advantage of the SDK/VDF.

 

If you want to use the SDK and/or VDF from Java, IMHO, your best bet is probably a third party Java to C# bridge, or possibly JNI.

 

-Dave

 



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
0 Likes
Message 3 of 5

Anonymous
Not applicable
We were able to dig through the classes and find a way around using a bridge. The original way our code was designed is, frankly, dumb, but we are stuck with it for now as a full redesign doesn't make sense. Thanks!
0 Likes
Message 4 of 5

james
Explorer
Explorer

I am also Trying to connect to Vault 2016 via Java, How did you get the connection? Can you share some code to point me in the right direction?

0 Likes
Message 5 of 5

abroderickHBFN6
Explorer
Explorer

Please tell me you (or somebody else) solved this problem... I'm facing it now.

 

Thanks!

0 Likes