Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Where i can find C# reference guide?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
The link works for me. It's a GTAC document on Solution Center so you'll need your webkey login. You can search for it yourself using query "001-7101846".

Randy Ellsworth, Teamcenter Architect, Applied CAx, LLC
NX 11 | SW 2016 | Creo 4 | TcUA 11.4
Evaluating: AW 3.4

Re: Where i can find C# reference guide?

Experimenter
Experimenter

Hi,

 

Thanks for your suggestion. Unfortunately, I am unable to get into Solution Center eventhough I have logged in successfully in to GTAC. Please refer the screenshot of the page which I am getting after clicking Solution Center. A direct link may to the query "001-7101846" if possible.

 

by the way, I have question regarding NXOPEN Journaling. I hope I can ask in this thread.

 

I am using Teamcenter and NX 11 triggered from Teamcenter. I want to get the list of children of a given assembly (Type: DesignRevision) and then loop them to set each child to workpart so that to get user attributes of each child via NXOpen journal programming. I know the following codes should help on this.

 

Public theUfSession As UFSession = UFSession.GetUFSession()
Public ufpart As UFPart = theUfSession.Part
Public ufassem As UFAssem = theUfSession.Assem

 

Or using the below codes

 

Dim Assy As Component

For Each comp In Assy.GetChildren

       lw.WriteLine(comp.DisplayName)

       Dim workpart As Part = comp.Prototype.OwningPart

       ' further codes down

Next

 

And then I can use "ufpart" and "ufassem" objects to query the children and any other available attributes related to the assembly using "ufassem.Askxxxxx()" and using "ufpart.Askxxxxx()". But, in order to use these methods, I must load relevant assemblies or part into NX as per the error message i get if I try to execute such program codes without loading part in NX.

 

But I want to do this without loading any part into NX. This may be my silly requirement, but still I want to check if there my be sime tricks to it. My argument regarding my aim is that, NX has launched from Teamcenter with legal teamcenter login. So NX holds NXOpen session and PDMSession and it somehow keep connecting to Teamcenter. If we could execute the following code successfully and get the results correctly without loading any part, then there might ba a similar way to query the children items of an assembly without opening that assembly in NX.

 

Dim ugmgr As UFUgmgr = theUfSession.Ugmgr

 

Dim part_number As String = "examplepartnumber"
Dim parttag As Tag
Dim revcount As Integer
Dim revstr() As Tag

 

ugmgr.AskPartTag(part_number, parttag)

ugmgr.ListPartRevisions(parttag, revcount, revstr)

 

For i As Integer = 0 To revcount - 1

    ugmgr.AskPartRevisionId(revstr(i), rev)

    lw.WriteFullline(rev.ToString)

 Next

 

Using the above code, it actually queries the list of revisions from Teamcenter or fron NX or whatever without loading a part just by giving the part number string. I am just looking for an additional information (Children part numbers of a part if the part number is assembly) without loading parts.

 

Moreover, I know there is a way to silently open an assembly or part using the following code. But this method still takes the time to load. I exactly want to save the loading time even it is loading silently.

 

Dim part_number As String = "Examplepartnumber" 

Dim RevisionNumber As String = "A"

Dim workPartTags As Tag = Tag.Null

Dim NullTags As Tag = Tag.Null

Dim ls = UFPart.LoadStatus = Nothing

 

' the below code are to open Assembly silently and set into workpart, but it still takes same loading time as if we do it manually

 

theUfSession.Part.OpenQuiet("@DB/" & part_number & "/" & RevisionNumber & "/" & "specification" & "/" & part_number & "-" & part_number & "-dwg1", workPartTags, ls)


theUfSession.Assem.SetWorkPartQuietly(workPartTags, NullTags)

 

Note: sorry for mixing two different topics, If I get required answer, then I can able to separate the topics from next thread.

 

Thanks & Regards,

Palani

Re: Where i can find C# reference guide?

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Re: Where i can find C# reference guide?

Experimenter
Experimenter

Hi,

 

Thanks again for the links to download Soa_client.zip.

 

I tried C# example for "HelloTeamcenter". But it doesn't work for me because the example is intended for Standard Credential type. But my Teamcenter service is of type SSO credential type. There is a Class called "AppXCrendentialManager" by which an object named "credentialmanager" is created in Session Class.

 

So I am in position to change the code in "AppXCrendentialManager.cs" in such a way that it should represent the SSO credential type. I just have replaced the following line under one of the method (CredentialType) in "AppXCrendentialManager.cs".

 

get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_STD; }

 

into

 

get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_SSO; }

 

But, if I run after the change and rebuilding the project, it keeps asking for User Name and Password. As far as I understood, The CredentialManaget class will try to reauthenticate with right Credential type (Standard or SSO) based on the Web Tier specified for the Teamcenter service. In my business, I am sure that Credential type is SSO because I always login to Teamcenter with SSO only. So my expectation on the programming side was that it should be by default "SSO" credential type..

 

May be something more need to be changed on the HellöTeamcenter project classes code. Please guide me or provide exct lines of codes that to be changed so that I should run HelloTeamcenter example.

 

Thanks & Regards,

Palani

Re: Where i can find C# reference guide?

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

@PLMatHamburgyou need to use LoginSSO() method with a different credential manager called SsoCredentials. GetCredentials method opens a browser, where you have to enter credentials for first login. Next time no credentials are required, unless the sso session is exprired. Here's sample code

 

 

SsoCredentials ssoCredentials = new SsoCredentials(ssoLoginURL, ssoAppID);
                ssoCredentials.SetUserPassword(user, password, discriminator);
                ssoCredentials.SetGroupRole(group, role);

                String[] credentials = ssoCredentials.GetCredentials(new InvalidUserException());

                m_connection = new Connection(serverAddress, new System.Net.CookieCollection(), ssoCredentials, SoaConstants.REST, "HTTP", false);
                m_connection.SetOption("OPT_SERVER_REASSIGNMENT", "true");

                addEventListener(m_connection);

                Teamcenter.Services.Strong.Core.SessionService ssoSessionSvc = SessionService.getService(m_connection);

                LoginResponse output1 = ssoSessionSvc.LoginSSO(credentials[0], credentials[1], credentials[2], credentials[3], locale, credentials[4]);

Re: Where i can find C# reference guide?

Experimenter
Experimenter
Hi,

when I try to implement your codes for SsoCredentials related, I got the
following run time error exactly at the code

String[] credentials = ssoCredentials.GetCredentials(new
InvalidUserException());
Error:
**************
Could not load file or assembly 'Teamcenter_SSOloader, Version=10.1.0.0,
Culture
=neutral, PublicKeyToken=0edd5b5ddd601444' or one of its dependencies. The
locat
ed assembly's manifest definition does not match the assembly reference.
(Except
ion from HRESULT: 0x80131040)

***************************

I actually referenced Teamcenter_SSOloader.dll, Teamcenter_SSO.dll and
Teamcenter_SSO64.dll libraries already in my project.
I may be missing to include on the "Using" statements at the beginning of
the class file.

But don't even know how to write "using" statement for
Teamcenter_SSOloader.dll.

Please guide me on how to write "using statement" for
Teamcenter_SSOloader.dll.

using XXXXXXXXXXX -- ????

Thanks & Regards,
Palani

Re: Where i can find C# reference guide?

Solution Partner Legend Solution Partner Legend
Solution Partner Legend
If you don't use a required 'using' statement in code, it won't compile at all.
As you got runtime exception, and not during compiling, then it's not related to code. But the program is somehow unable to find/load the dll.

Another issue could be related to .Net version. Apparantly you are using Teamcenter10, so make sure you compile the program with Target Framework 3.5 and that the same is installed on your computer.

Re: Where i can find C# reference guide?

Experimenter
Experimenter

Yes. I get the error only at run time. Now I just have changed my Target .NEt Framework to 3.5 and buided the project, but I still get the same error. But diffrent error, but it is similar to prvious error. The difference between the previous error and the latest error is  hilighted as bold font below. If you notice the sentence which hilighted with bolt font is not exist in the latest error.

 

Previous error:

**************
Could not load file or assembly 'Teamcenter_SSOloader, Version=10.1.0.0,
Culture
=neutral, PublicKeyToken=0edd5b5ddd601444' or one of its dependencies. The
locat
ed assembly's manifest definition does not match the assembly reference.
(Except
ion from HRESULT: 0x80131040)

***************************

 

Latest error:

**************

 

Could not load file or assembly 'Teamcenter_SSOloader, Version=10.1.0.0, Culture
=neutral, PublicKeyToken=0edd5b5ddd601444' or one of its dependencies. The syste
m cannot find the file specified.

 

***************************

 

One another question is that, whay we should use the following line of code. Because the login method is SSO. In my business if I want to login to Teamcenter application, I have to launch Teamcenter and a Browser will open and ask for PIN Number. It won't ask for Username at all. Since you are also part of Siemens you have better understanding about PKI Card usage. I am also working "Siemens Wind Power GmbH". Please clarify what meant for user, password in the following line of code if I use PKI PIN to login. I hope I can parse empty string ("") for discriminator, if not, please guide me. Does the password meant for "PKI PIN" number? If no and if you say I have to enter my username and password what is to be parsed to Teamcenter, then I see there is no difference between LoginSSO and Standard Login.

 

ssoCredentials.SetUserPassword(user, password, discriminator);

 

Thanks & Regards,

Palani

 

Re: Where i can find C# reference guide?

Experimenter
Experimenter

Hi,

 

The link to download "soa_client.zip" which you have provided is for Teamcenter 11.

I am using "Teamcenter 10 (10.1.5_a01_6(20161206.00)) 64-bit". Could you please provide the link to download "soa_client.zip" for Teamcenter 10.

 

Thanks & Regards,

Palani

Re: Where i can find C# reference guide?

Experimenter
Experimenter

Hi,

 

I am looking for the link to download "soa_client.zip" for Teamcenter 10. RandyEllsworth has provided the link for Teamcenter 11 using which I am unable to run "HelloTeamcenter" code because of the differnet version of Teamcenter.

 

It would be a great help if you send me the link to download "soa_client.zip" for teamcenter 10. For your information, the below is the exact version of teamcenter I am using.

 

Teamcenter 10 (10.1.5_a01_6(20161206.00)) 64-bit

 

Thanks & Regards,

Palani