cancel
Showing results for 
Search instead for 
Did you mean: 

How to download files using FMU or FMS? How to create FMS tickets?

Pioneer
Pioneer

FMS, FCC, and FSC in Teamcenter

-File Management System (FMS)

-File Client Cache (FCC)

-File Server Cache (FSC)

-Teamcenter Client Communication System (TCCS)

 

Currently I have this (coding in C#):

FileManagementUtility fmu = new FileManagementUtility(Session.getConnection()); 
fmu.GetFileToLocation(modelObject, "C:/Users/jtth/Desktop/TestFolder/", null, null);

 

 

But this doesn't return anything, and no file is downloaded. 

 

Based on what I've found, and the link I provided, another approach I found would be to use an FMS ticket and pass it to GetFile() to download my file locally. This might be the way to go as passing the modelObject to GetFileToLocation() isn't working.

 

I have added the following to the Environment variable PATH (in both User and System):

%FMS_HOME%\lib and %FMS_HOME%

 

I've googled "how to create an FMS ticket" and checked on these forums, but I have yet to find anything substantial.

So, how do I create an FMS ticket? 

 

EDIT: Thank you for answering these previous questions:

If I need more properties then what are defaulty enabled, (i.e. IMAN properties), how do I enable properties in C#? 

 

22 REPLIES

Re: Help with downloading files using FMS

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
Have you installed a local FCC/TCCS (see INSTALL_MEDIA\additional_applications\tccs_install)? AFAIK, it is required unless you're using Active Workspace. TCCS comes with the installation of the rich client however it sounds like you are running outside the rich client.

Randy Ellsworth, Teamcenter Architect, Applied CAx, LLC
NX 11.0.1.mp01 | SW 2016 | TcUA 11.2.3
Evaluating:AW 3.2

Re: Help with downloading files using FMS

Pioneer
Pioneer
FileManagementService fms = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection());
DataManagementService dms = DataManagementService.getService(Teamcenter.ClientX.Session.getConnection());

ImanFile[] aIMANFiles = new ImanFile[1];
aIMANFiles[0] = new ImanFile(stl.SoaType, stl.Uid);

Teamcenter.Services.Strong.Core._2006_03.FileManagement.FileTicketsResponse getFileResp = fms.GetFileReadTickets(aIMANFiles);

string[] tickets = new string[getFileResp.Tickets.Count];
string[] paths = new string[getFileResp.Tickets.Count];
int a = 0;

foreach (System.Collections.DictionaryEntry pair in getFileResp.Tickets)
{
    tickets[a] = (String)pair.Value;

    paths[a] = ((ImanFile)pair.Key).Original_file_name;
    a++;
}



//if (aPrgDialog.isRunning() == true)
//{
//    aPrgDialog.addPos();
//    aPrgDialog.setText(String.Format(m_pUtilities.GetMessage("R277"), Convert.ToString(paths.Length)));
//    aPrgDialog.pumpMessage();

    string[] uids;
    int[] ifails;
    string checkoutFolder = "C:/Users/jtth/Desktop/TestFolder/";

    Teamcenter.FMS.FCCProxy.ClientCache.NetFileCacheProxy fmsfileCacheProxy = new Teamcenter.FMS.FCCProxy.ClientCache.NetFileCacheProxy();
    fmsfileCacheProxy.RegisterTickets(tickets, out uids, out ifails);



    if (ifails.Length > 0) { throw new Exception("Errors Registering file tickets"); }

    fmsfileCacheProxy.DownloadFilesToLocation("Default", uids, null, paths, checkoutFolder, paths, out ifails);
//}

Would that returning this:

Exception thrown: 'System.BadImageFormatException' in SOATests.exe
Could not load file or assembly 'FCCNetClientProxy64, Version=9.1.0.0, Culture=neutral, PublicKeyToken=0074cebd077fc3ec' or one of its dependencies. 
An attempt was made to load a program with an incorrect format.

Be concurrent with needing to install a local FCC/TCCS?

 

Note: The original code for what I am trying to implement there is from Export-file-stored-in-Teamcenter-using-SOA-library-in-C#

Re: Help with downloading files using FMS

Siemens Phenom Siemens Phenom
Siemens Phenom

About getting the properties:

In Java you can use ObjectPropertyPolicy e.g.:

SessionService session = SessionService.getService(AppXSession.getConnection());
ObjectPropertyPolicy policy = new ObjectPropertyPolicy();
PolicyType datasetType = new PolicyType("Dataset");
PolicyProperty property = new PolicyProperty("ref_list");
datasetType.addProperty(property);
policy.addType(datasetType);
policy.addType("ImanFile", new String[]{ "original_file_name" });
session.setObjectPropertyPolicy(policy);

or load the properties directly:

dmService = DataManagementService.getService(AppXSession.getConnection());
String[] dsProperties = new String[] { "ref_list" };
dmService.getProperties( new ModelObject[] { dataset }, dsProperties );

HTH,

xtof

 

Re: Help with downloading files using FMS

Pioneer
Pioneer
Randy- how do I know if I am working in an active workspace. Where is the path you referenced located so I can see if I have a local FCC/TCCS (File client cache/Teamcenter client communication system)?

Re: Help with downloading files using FMS

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
What does FMS_HOME point to? Is anything installed there? If not then you'll need to install it from the Teamcenter installation media. You can find the installer in the installation media located at additional_applications\tccs_install\.

Randy Ellsworth, Teamcenter Architect, Applied CAx, LLC
NX 11.0.1.mp01 | SW 2016 | TcUA 11.2.3
Evaluating:AW 3.2

Re: Help with downloading files using FMS

Pioneer
Pioneer

C:\Siemens\Teamcenter\CGCA705.COM\tccs\lib, lots of stuff installed here. What am I looking for

Re: Help with downloading files using FMS

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
FMS_HOME should point to the tccs directory (not lib).

Randy Ellsworth, Teamcenter Architect, Applied CAx, LLC
NX 11.0.1.mp01 | SW 2016 | TcUA 11.2.3
Evaluating:AW 3.2

Re: Help with downloading files using FMS

Pioneer
Pioneer

It now points to tccs directory.
Returns:

Exception thrown: 'System.BadImageFormatException' in SOATests.exe
Could not load file or assembly 'FCCNetClientProxy64, Version=9.1.0.0, Culture=neutral, PublicKeyToken=*omitted*' or one of its dependencies. 
An attempt was made to load a program with an incorrect format.

Through some commenting it appears this is where my program crashes.

Teamcenter.FMS.FCCProxy.ClientCache.NetFileCacheProxy fmsfileCacheProxy = new Teamcenter.FMS.FCCProxy.ClientCache.NetFileCacheProxy();

I added FCCNetClientProxy4064.dll to replace FCCNetClientProxy64 (appears that 4064 is tc11 and 64 is tc9), but I still get BadImageFormatException. 

 

Re: Help with downloading files using FMS

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor
check your PATH environment variable. %FMS_HOME%\lib must be added to PATH. This is where FCC looks for the libraries.