Insufficient relationship count (0) of Located relationships. At least 1 required.
I can't vault a file - can some one explain what I'm doing wrong?
Dim conn As IOM.HTTPServerConnection = New IOM.HTTPServerConnection
conn.innovator_server_url = "http://10.12.19.57/InnovatorServer/Server/InnovatorServer.aspx"
conn.http_username = "willig01"
conn.http_password = IOM.Innovator.ScalcMD5("12345678")
conn.http_database = "InnovatorSolutions"
conn.vault_server_url = "http://10.12.19.57/InnovatorServer/vault/VaultServer.aspx"
queryItem.setAttribute("select", "login_name")
System.Console.WriteLine("Number of Users: " & qryRes.getItemCount)
fileItm.setFileName("C:\Gary\CMII\Legend.dwg")
Console.WriteLine(Res.getErrorDetail)
conn.Close()
I had the same problem on a project last month. The solution is quite easy. Innovator uses a distributed/replicated vaulting model. The File Item has a relationship to Vault item, that allows you to specify which vault the file should be stored into. A File can be Located in 1 or more Vaults, but has to be in at least one Vault. The error message indicates that at least one instance of the Located relationship is required.
here's what I usually do:
After connecting, the first query I run is to request the Default Vault for the current user, this confirms that the connection parameters are valid, and gets the Vault ID that I need. This also gets the URL to the Vault Server (you have this hard-coded in your sample).
When you create the File item, you also need to create a Located relationship underneath it to specify the vaulting meta-data. Then do the Apply(). VB.NET sample follows:
Dim ConnectTest As Item = inn.newItem("User", "get") ConnectTest.setAttribute("select", "default_vault") ConnectTest.setProperty("login_name", vUsername) Dim ConnectTestResult As Item ConnectTestResult = ConnectTest.apply() If ConnectTestResult.isError() Then MsgBox("Error: " & ConnectTestResult.getErrorDetail(), , "Publish2Innovator") MyConnection.Logout() Return End If vDefaultVault = ConnectTestResult.getProperty("default_vault")
This sample takes the username provided, and tries to connect, and if successful, returns the ID of the default vault for this user. Next sample shows how to use this with the File item.
Dim File As Item = MyItem.newItem("File", "add") File.setProperty("filename", filename) File.setProperty("actual_filename", pathname) File.setProperty("checkedout_path", pathname.Substring(0, pathname.LastIndexOf("\"))) File.attachPhysicalFile(pathname, vDefaultVault)I am using a different IOM function here, that sets the filename and builds the Located relationship in one step. You could also more explicitly just create the relationship under your File item:
Dim fileItm As Item = inn.newItem("File", "add") Dim fileLocatedRel As Item = inn.newItem("Located", "add") fileItm.setFileName("C:\Gary\CMII\Legend.dwg") fileLocatedRel.setProperty("related_id",vDefaultVault) fileItm.addRelationship(fileLocatedRel) Dim Res As IOM.Item = fileItm.apply()
Let me know if this works. NOTE: there were some fixes in the IOM.DLL (patch for the 8.1.1 publically released version). Drop me an email if you want the updated IOM. pschroer@aras.com
Thank you for the help. Files are going in the Vault now.
I have a problem viewing tif files though. The viewer loads I can see it - then I'm asked to install active x control ArasIG.cab and when I do I get a blank page.
I spoke to soon - the file never gets in the vault. It has a location path but the path is not there.
It is in the files form.
conn.http_username = "admin"
conn.http_password = IOM.Innovator.ScalcMD5("innovator")
ConnectTest.setAttribute("select", "default_vault")
ConnectTest.setProperty("login_name", "admin")
ConnectTestResult = ConnectTest.apply()
MsgBox("Error: " & ConnectTestResult.getErrorDetail(), , "Publish2Innovator")
docItm.setProperty("item_number", "112")
Console.WriteLine(docRes.getErrorDetail)
EDdocItm.setAttribute("where", "[DOCUMENT].ITEM_NUMBER='112' and [DOCUMENT].IS_CURRENT='1'")
EDdocItm.setProperty("Description", "Desc???")
fileLocatedRel.setProperty("related_id", vDefaultVault)
fileItm.addRelationship(fileLocatedRel)
fileItm.setProperty("file_type", "F2B9580CB239419A8CB12A02E4FC6962")
fileItm.setProperty("file_size", size)
relItm.setRelatedItem(fileItm2)
EDdocItm.addRelationship(relItm)
fileItm2.unlockItem()
EDdocItm.unlockItem()
You'll need the patched IOM.DLL - the 8.1.1 released version works for everything but the file handling.
There is a work around: you can create the SOAP and XML message yourself (IOM is a developers convenience layer) and this works just fine. The underlying web service is working... the IOM is just not handling the physical file hand-off to the Vault's web service.
Customers on support contracts have access to the patched IOM.DLL, drop me an email if you want to try it, or we can show you the work around.
Version 8.2 release to subscribers is a couple weeks out. It's in the Test and Release process right now. The "open" posting of the 8.2 code base will likely follow the customer release by several weeks.
Drop me an email and let me know what you are working on. I'll see if I can help. pschroer@aras.com
In release 8.2 IOM API has gone through some cleanup during which we tried to achieve several goals:
- have a single implementation of IOM API (prior to 8.2 there were 3 different implementations: .NET, JavaScript and COM) - remove or obsolete methods that did not belong to the API and all they did could be easily achieved by other means. For example, everything the method Item.getWorkflows() did was getting relationships of type “Workflow” of the item, which can be done by just calling Item.getRelationships( “Workflow”). Currently IOM API contains only methods that are required to build an AML request; send it to the server and parse server AML response; plus a small set of utility methods (like Innovator.ScalcMD5(), etc.). Everything else that does not meet the criteria was removed from the IOM API in release 8.2 or was declared obsolete (these methods are still there but you'll get compilation warnings if you use them) and would be removed from future releases of IOM. - provide a consistent way of login to Innovator - provide a simple and transparent mechanism of uploading files to vault
- have a single implementation of IOM API (prior to 8.2 there were 3 different implementations: .NET, JavaScript and COM)
- remove or obsolete methods that did not belong to the API and all they did could be easily achieved by other means. For example, everything the method Item.getWorkflows() did was getting relationships of type “Workflow” of the item, which can be done by just calling Item.getRelationships( “Workflow”). Currently IOM API contains only methods that are required to build an AML request; send it to the server and parse server AML response; plus a small set of utility methods (like Innovator.ScalcMD5(), etc.). Everything else that does not meet the criteria was removed from the IOM API in release 8.2 or was declared obsolete (these methods are still there but you'll get compilation warnings if you use them) and would be removed from future releases of IOM.
- provide a consistent way of login to Innovator
- provide a simple and transparent mechanism of uploading files to vault
Here is a small C# example based on 8.2+ IOM API that demonstrates how to connect to Innovator server; create item of type "File"; attach a physical file to it and submit the item to Innovator (which will upload physical file to the vault server and create an item of type "File" in Innovator's database that references the physical file in vault):
using
namespace
{
CheckOut(inn, file_id, args[5]);
}
fitem.setProperty(
fitem.attachPhysicalFile(file_path);
get_file_request.setType(
get_file_request.setAction(
get_file_request.setID(file_id);
sb.Append(