Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vault login with API

9 REPLIES 9
Reply
Message 1 of 10
lornemartin
2057 Views, 9 Replies

vault login with API

I am trying to run the C# VaultFileBrowser sample program in the vault 2012 SDK.  Everything compiles ok, but when I run it and try to log in, I always get an error saying 'Error: Logon Failed'.  I am using exactly the same login info as when I normally log into the Vault. Does anybody have any idea of what could be going on?.

  The line that throws the exception is this:  

ServiceManager = new WebServiceManager(new UserPasswordCredentials(
                    loginInfo.ServerString, loginInfo.Vault, loginInfo.Username, loginInfo.Password));

 I have a working program that uses the older way of logging in:

public static void InitServices()
        {         
            secSrv.SecurityHeaderValue = new Autodesk.Connectivity.WebServices.SecuritySvc.SecurityHeader();
            secSrv.Url = "http://" + HOST + "/AutodeskDM/Services/SecurityService.asmx";
            secSrv.SignInReadOnly("lorne", "lorne", "Vault");
            
            docSrv.SecurityHeaderValue = new Autodesk.Connectivity.WebServices.DocumentSvc.SecurityHeader();
            docSrv.SecurityHeaderValue.UserId = secSrv.SecurityHeaderValue.UserId;
            docSrv.SecurityHeaderValue.Ticket = secSrv.SecurityHeaderValue.Ticket;
            docSrv.Url = "http://" + HOST + "/AutodeskDM/Services/DocumentService.asmx";
            
            propSvc.SecurityHeaderValue = new Autodesk.Connectivity.WebServices.PropertySvc.SecurityHeader();
            propSvc.SecurityHeaderValue.Ticket = secSrv.SecurityHeaderValue.Ticket;
            propSvc.SecurityHeaderValue.UserId = secSrv.SecurityHeaderValue.UserId;
            propSvc.Url = "http://" + HOST + "/AutodeskDM/Services/PropertyService.asmx";   
        }

  I notice that with this code I am signing in as read-only, could that be what is causing the login to fail in the sample program?

9 REPLIES 9
Message 2 of 10
Redmond.D
in reply to: lornemartin

Run in the debugger and verify all that the inputs to UserPasswordCredentials are correct.  What is the ServerString value?

I don't think this is a read-only issue.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 10
lornemartin
in reply to: lornemartin

 

Message 4 of 10
Redmond.D
in reply to: lornemartin

That all looks good and the WebServiceManager should be able to handle a server on a different port.

The server you are connecting to, is it a Vault 2012 server?



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 5 of 10
lornemartin
in reply to: Redmond.D

Yes, it is a Vault 2012 server. 


@DOUG.redmond wrote:

That all looks good and the WebServiceManager should be able to handle a server on a different port.


I'm not quite following, I do want to connect using the same port as when I 'normally' log in don't I?  The bottom screenshot on my previous post shows my normal log in values.

Message 6 of 10
Redmond.D
in reply to: lornemartin

My port comment was referring to the fact that your server is not running on the default port 80.

 

Some other things to check.

- Which line of code is failing?  Is it the line that sets "ServiceManager" or the line that set "VaultExplorer"?

- Are you using the basic version of Vault?



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 7 of 10
lornemartin
in reply to: lornemartin

It's failing on the ServiceManager line.  The output window shows this:

A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in Microsoft.Web.Services3.dll
A first chance exception of type 'System.Exception' occurred in Autodesk.Connectivity.WebServicesTools.dll

 We are using Vault Collaboration.

Message 8 of 10
Redmond.D
in reply to: lornemartin

You are getting a configuration Exception from Microsoft.Web.Services3.  I think that's the problem.

 

Either the app.config file has been modified or Web Service Extensions (WSE 3) is not installed.  WSE 3 is part of the Vault client and server install.  See this article for more information.  That should get the WebServiceManager to log in property.

 

Note: The VaultExplorer line will fail if Vault Client is not installed.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 9 of 10
lornemartin
in reply to: lornemartin

I do have WSE installed and as far as I can tell from the article you referenced, it's setup properly, at least the config files look right. I don't have access to the server to do the test you describe. You mention that WSE is part of the vault install. I do remember installing it separately, so maybe something is not quite set up right. 

  I also see that I didn't copy all of the lines from the output window before, maybe that would point to a possibly different problem?

'VaultFileBrowser.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
A first chance exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
A first chance exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in Microsoft.Web.Services3.dll
A first chance exception of type 'System.Exception' occurred in Autodesk.Connectivity.WebServicesTools.dll

 

Message 10 of 10
Redmond.D
in reply to: lornemartin

Try running as an administrator to see if that clears up the security Exceptions.



Doug Redmond
Software Engineer
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report