+ All Categories
Home > Documents > Tc Project a Pius Er Guide 50

Tc Project a Pius Er Guide 50

Date post: 14-Apr-2015
Category:
Upload: projettueur
View: 26 times
Download: 0 times
Share this document with a friend
59
Teamcenter ® Project API User’s Guide Publication Number TP00302 G
Transcript
Page 1: Tc Project a Pius Er Guide 50

Teamcenter® Project

API User’s Guide

Publication NumberTP00302 G

Page 2: Tc Project a Pius Er Guide 50
Page 3: Tc Project a Pius Er Guide 50

Teamcenter® Project

API User’s Guide

This product is intended for use only as described in this document. UGScannot be responsible for the proper functioning of undescribed featuresand parameters.

Publication NumberTP00302 G

Page 4: Tc Project a Pius Er Guide 50

Manual History

ManualRevision

Teamcenter ProjectVersion

PublicationDate

A 1.0 June 2001

B 2.0 December 2001

C 3.0 September 2002

D 3.2 March 2003

E 4.0 December 2003

F 4.1 May 2004

G 5.0 November 2004

This edition obsoletes all previous editions.

©2004 UGSAll rights reserved.Produced in the United States of America.

2 Teamcenter Project API User’s Guide TP00302 G

Page 5: Tc Project a Pius Er Guide 50

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Submitting Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Software Copyright and Trademark Notices . . . . . . . . . . . . . . . . . . . . . . 7

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1

Introduction to the Teamcenter Project API . . . . . . . . . . . . . . . . . . . . . . 1-1Objects and Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2Communicating with Teamcenter Project . . . . . . . . . . . . . . . . . . . . . . . 1-3Operations Available in the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4

Standard Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

Standard Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

Using the Java API Client Library to Access the API . . . . . . . . . . . . . . 3-1

Java Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1Secure Communications Using SSL . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

Using WSDL to Access the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1

C# Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2Needed Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7Secure Communications Using SSL . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

Debugging the Client Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1

API Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1Third-Party TCP Trace Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1

Figures

1-1. Communicating between the Client Application and TeamcenterServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

3-1. Client Library Java Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23-2. SSL Sample Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-44-1. Client Library C# Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24-2. Sample Proxy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44-3. WSDL File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

TP00302 G Teamcenter Project API User’s Guide 3

Page 6: Tc Project a Pius Er Guide 50

Contents

5-1. Sample Client-Side API Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25-2. Sample Client Log Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25-3. Sample Server Log Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

Tables

1-1. Session Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-51-2. Workplace Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-61-3. Task Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-81-4. Member Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-111-5. Security Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-141-6. Folder Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-151-7. Document Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-161-8. Calendar Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-171-9. Link Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-181-10. Outline Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-192-1. Standard Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13-1. Choices for a Java API Client Application . . . . . . . . . . . . . . . . . . . . . 3-1

4 Teamcenter Project API User’s Guide TP00302 G

Page 7: Tc Project a Pius Er Guide 50

Preface

This manual describes the application programming interface for Teamcenter®

Project version 5.0. Teamcenter Project belongs to the UGS portfolio of digitalproduct lifecycle management software and services.

AudienceThis manual contains information for Teamcenter Project developers. It assumesthat you are familiar product concepts, XML (Extensible Markup Language), andSOAP (Simple Object Access Protocol).

For additional information regarding objects and the operations that can beperformed, refer to the Teamcenter Project User’s Manual.

OrganizationThis manual contains the following chapters:

Chapter 1 Introduction contains introductory information about theTeamcenter Project application programming interface (API).

Chapter 2 Standard Input Parameters lists the standard input parameterscommon to all Teamcenter Project APIs.

Chapter 3 Using the Java API Client Library to Access the API describes howto pass XML formatted parameters to Teamcenter Project APIs.

Chapter 4 Using WSDL to Access the API describes how to use theTeamcenter Project API client library.

Chapter 5 Debugging the Client Application contains information aboutdebugging the client application.

TP00302 G Teamcenter Project API User’s Guide 5

Page 8: Tc Project a Pius Er Guide 50

Preface

ConventionsThis manual uses the conventions described in the following sections.

Names and Values

This manual represents system names, file names, and values in fonts that help youinterpret the name or value. For example:

Change or add the parameter to the initsid.ora file.

The conventions are:

Bold Bold font represents unvarying text or numbers within a name orvalue. Capitalization is as it appears.

Italic Italic font represents text or numbers that vary within a name orvalue. The characters in italic text describe the entry. Letters areshown in lowercase, but the varying text may include uppercaseletters.

In initsid.ora, sid identifies a varying portion of the name (aunique system ID). For example, the name of the file might be:

initBlue5.ora

text-text A hyphen separates two words that describe a single entry.

Command Line Entries, File Contents, and Code

This manual represents command line input and output, the contents of system files,and computer code in fonts that help you understand how to enter text or to interpretdisplayed text. For example, the following line represents a command entry:

msqlora -u system/system-password

The conventions are:

Monospace Monospace font represents text or numbers you enter on acommand line, the computer’s response, the contents of systemfiles, and computer code.

Capitalization and spacing are shown exactly as you must enterthe characters or as the computer displays the characters.

Italic Italic font represents text or numbers that vary. The words in italictext describe the entry.

The words are shown in lowercase letters, but the varying textmay include uppercase letters. When entering text, use the caserequired by the system.

For the preceding example, you might substitute the following forsystem-password:

KLH3b

text-text A hyphen separates two words that describe a single entry.

6 Teamcenter Project API User’s Guide TP00302 G

Page 9: Tc Project a Pius Er Guide 50

Preface

Submitting CommentsPortions of Teamcenter software are provided by third-party vendors. Specialagreements with these vendors require UGS to handle all problem reports concerningthe software they provide. Please submit all comments directly to UGS.

Please feel free to give us your opinion of the usability of this manual, to suggestspecific improvements, and to report errors. Mail your comments to:

UGS Technical Communications4233 Lexington Avenue N., Suite 3290Arden Hills, MN 55126-6198U.S.A.

To submit an incident report, you can use the UGS GTAC online support toolsat the following URL:

http://support.ugs.com

Software Copyright and Trademark Notices© 2004 UGS Corp. All Rights Reserved. This software and related documentationare proprietary to UGS Corp. LIMITATIONS TO U.S. GOVERNMENT RIGHTS.UNPUBLISHED - RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OFTHE UNITED STATES. This computer software and related computer softwaredocumentation have been developed exclusively at private expense and are providedsubject to the following rights: If this computer software and computer softwaredocumentation qualify as "commercial items" (as that term is defined in FAR2.101), their use, duplication or disclosure by the U.S. Government is subject to theprotections and restrictions as set forth in the UGS Corp. commercial license for thesoftware and/or documentation, as prescribed in FAR 12.212 and FAR 27.405(b)(2)(i)(for civilian agencies) and in DFARS 227.7202-1(a) and DFARS 227.7202-3(a) (for theDepartment of Defense), or any successor or similar regulation, as applicable or asamended from time to time. If this computer software and computer documentationdo not qualify as "commercial items," then they are "restricted computer software"and are provided with "restrictive rights," and their use, duplication or disclosure bythe U.S. Government is subject to the protections and restrictions as set forth in FAR27.404(b) and FAR 52-227-14 (for civilian agencies), and DFARS 227.7203-5(c) andDFARS 252.227-7014 (for the Department of Defense), or any successor or similarregulation, as applicable or as amended from time to time. UGS Corp., 5800 GraniteParkway, Suite 600, Plano, Texas 75024.

Portions of the software are a copyright © 1991–2000 under exclusive perpetuallicense to HCL Technologies Ltd., 806-808 Siddarth, 96 Nehru Place, New Delhi,India.

Java and all Java-based marks are trademarks or registered trademarks of SunMicrosystems, Inc. in the United States and other countries.

Copyright © 1999-2000 The Apache Software Foundation. All rights reserved.This product includes software developed by the Apache Software Foundation(http://www.apache.org/).

All other trademarks or registered trademarks belong to their respective holders.

TP00302 G Teamcenter Project API User’s Guide 7

Page 10: Tc Project a Pius Er Guide 50
Page 11: Tc Project a Pius Er Guide 50

Chapter

1 Introduction

Introduction to the Teamcenter Project API . . . . . . . . . . . . . . . . . . . . . . . . 1-1

Objects and Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

Communicating with Teamcenter Project . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

Operations Available in the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4

TP00302 G Teamcenter Project API User’s Guide

Page 12: Tc Project a Pius Er Guide 50
Page 13: Tc Project a Pius Er Guide 50

Chapter

1 Introduction

Introduction to the Teamcenter Project APIThe Teamcenter Project API provides developers with a consistent and stableinterface allowing programmatic access to the information within Project. Thedeveloper has the option of implementing the API at a high level using Java, or byusing the included WSDL (Web Services Definition Language) files to generate aclient interface for any language/platform that supports SOAP.

TP00302 G Teamcenter Project API User’s Guide 1-1

Page 14: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Objects and OperationsAs a software developer, you can use the API to access the application’s data byperforming operations on the following Teamcenter Project objects:

• Workplaces• Memberships• Tasks• Timesheets• Members (people)• Folders• Documents• Calendars• Object Links• Task notebooks• Task notebook entries• Schedule baselines• Task baselines• Skill sets• Skill set memberships• Skill levels• Bill rates

You can use the following general categories of operations when manipulatingthe objects:

• Query• Create• Update• Delete

You can also manipulate security settings for workplaces, tasks, people, skill sets,folders, documents, and calendars.

You could write a program, for example, that uses the API to perform these simplefunctions:

• Create a workplace.• Create tasks within the workplace.• Add members to the workplace.• Assign members to the tasks.

1-2 Teamcenter Project API User’s Guide TP00302 G

Page 15: Tc Project a Pius Er Guide 50

Introduction

Communicating with Teamcenter ProjectYou always need to go through the following steps when using the API:

1. Establish a connection to the server.

2. Perform the desired operations.

3. Terminate the connection.

These activities are handled through request messages sent to the server andresponse messages returned to the external program. Figure 1-1 illustrates thissequence of events.

Figure 1-1. Communicating between the Client Application and TeamcenterServer

The Perform Operations step can include as many request/response pairs asnecessary to accomplish what is required by the program—querying, object creationand deletion, and object manipulation.

TP00302 G Teamcenter Project API User’s Guide 1-3

Page 16: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Operations Available in the APIEach operation, or function, that the API supports, is classified as one of sixcategories, called services:

Session Service Opens or closes an API connection to the server.

Workplace Service Performs operations on workplaces, memberships,bill rates, schedule baselines, and task baselines.

Task Service Performs operations on tasks and timesheets.

Member Service Performs operations on members (people andskill sets).

Folder Service Performs operations on folders for workplaces,people, and skill sets.

Security Service Manipulates security for workplaces, people,skill sets, and folders.

Document Service Performs operations, such as uploading anddownloading, on documents.

Calendar Service Performs operations on calendars.

Link Service Performs operations on external links.

Outline Service Performs operations on task notebooks and tasknotebook entries.

The complete list of API functions is shown in the four tables below, grouped byservice. The tables describe each function along with the response expected fromthe server.

1-4 Teamcenter Project API User’s Guide TP00302 G

Page 17: Tc Project a Pius Er Guide 50

Introduction

Table 1-1. Session Service Functions

Function Name Description Expected Response

beginApiSession Opens an APIconnection to theserver.

The session ID assigned to thissession.

endApiSession Closes the APIconnection.

true.

getServerTimeZoneID Gets theJava-compatibletime zone ID fromthe server.

String containing the timezone ID for the server.

TP00302 G Teamcenter Project API User’s Guide 1-5

Page 18: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-2. Workplace Service Functions

Function Name Description Expected Response

addMembership Adds an existingmember to aworkplace.

The resulting membership.

deleteScheduleBaseline

Deletes a schedulebaseline.

The baseline that was deleted.

deleteWorkplace Deletes aworkplace.

Success or failure response.

getBillRateForWorkplace

Gets the bill ratefor a workplace.

The bill rate.

getBillRateForWorkplaces

Gets the availablebill rates for aworkplace.

Array of bill rates.

getCostForWorkplace

Gets cost for aworkplace.

Cost bundle.

getFixedCostForWorkplace

Gets the fixed costfor a workplace.

The fixed cost.

getLauncherURLForWorkplace

Gets launcher URLfor a workplace.

A string containing a launchURL for the workplace.

getMembership Gets membershipsfor a workplace.

The memberships in theworkplace.

getMembershipbyOid

Gets amembership, givenits OID.

The desired membership.

getScheduleBaseline

Gets the schedulebaseline.

The baseline.

getTaskBaselines

Gets the taskbaselines.

The task baselines.

getWorkplaceByOid Gets a workplaceby its OID.

The desired workplace.

getWorkplaceForTask Gets a workplacefor a given task.

The workplace in which thetask is located.

newScheduleBaseline

Creates a newschedule baseline.

The new baseline.

newWorkplace Creates oneor more newworkplaces.

The new workplaces.

removeMembership Removes a memberfrom a workplace.

Success or failure response.

queryMemberships Queriesapplicationfor existingmemberships.

Zero or more membershipsmeet the query specifications.

1-6 Teamcenter Project API User’s Guide TP00302 G

Page 19: Tc Project a Pius Er Guide 50

Introduction

Table 1-2. Workplace Service Functions

Function Name Description Expected Response

queryWorkplaces Queriesapplicationfor existingworkplaces.

Zero or more workplaces thatmeet the query specifications.

updateBillRateForWorkplace

Updates thebill rate for aworkplace.

None.

updateFixedCostForWorkplace

Updates thefixed cost for aworkplace.

The updated workplace.

updateScheduleBaseline Updates a schedulebaseline.

The updated baseline.

updateMembership Updatesan existingmembership.

The updated membership.

updateWorkplace Updates anexisting workplace.

The updated workplace.

TP00302 G Teamcenter Project API User’s Guide 1-7

Page 20: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-3. Task Service Functions

Function Name Description Expected Response

assignDependency Creates adependencybetween twotasks, specifyingdependency typeand lag time.

Array of tasks that wereaffected by new dependencyrelationship, or else asuccess/failure response.

assignSubTask Makes one task asubtask

Success or failure response.

assignSubTaskAffected Assigns anew subtaskrelationshipbetween two tasks.

Array of tasks that wereaffected by new subtaskrelationship.

assignTask Assigns a memberto a task.

Success or failure response.

assignTaskAffected Assigns a memberto a task.

The task to which the memberwas assigned.

copyTask Copies a task alongwith its subtasks,assignments, andoutlines to thesame or a differentworkplace.

Array of tasks, including thenew top-level task plus affectedtasks.

deleteTask Deletes an existingtask.

Success or failure response.

deleteTaskAffected Deletes an existingtask.

Array of tasks that wereaffected by deleting the task.

getCostForTask Gets cost for a task. Cost bundle.

getFixedCostForTask Gets the fixed costfor a task.

The fixed cost.

getHomeTask Gets the home taskfor a linked task.

The home task.

getLauncherURLForTask

Gets launcher URLfor a task.

A string containing a launchURL for the task.

getLinkedTasks Gets the linkedtasks for a task.

Array of tasks.

getMemberTaskAssignments

Gets an assignmentof a task to amember.

The task assignment.

getSubTasks Queries serverfor tasks that aresubtasks of thespecified task.

Array of subtasks.

1-8 Teamcenter Project API User’s Guide TP00302 G

Page 21: Tc Project a Pius Er Guide 50

Introduction

Table 1-3. Task Service Functions

Function Name Description Expected Response

getTaskByOid Gets a task by itsOID.

The task.

getTaskDependencies Queries serverfor tasks that aredependent on thespecified task.

Array of task dependencies.

getTasksForMember Gets tasks for amember (person orskill set).

The tasks for the member.

getTasksForPerson Gets tasks for amember.

The tasks for the member.

insertNewTask Creates one oremore new tasksand insert themat a point in theworkplace.

The new tasks.

newMemberTaskAssignment

Creates a newassignmentbetween a memberand a task.

The new assignment.

newTask Creates one ormore new tasks ina workplace.

The new tasks.

newTaskAffected Creates one ormore new tasks ina workplace.

Array of tasks including thenew task plus tasks that wereaffected by creation of newtask.

queryMemberTaskAssignments

Gets the taskassignments fora member.

Array of task assignments.

queryTasks Queries applicationfor existing tasks.

Zero or more tasks that meetthe query specifications.

queryTaskOids Queries for OIDs ofexisting tasks.

One or more strings, eachidentifying the OID of a task.

recalculateSchedule Recalculatesschedule for one ormore workplaces.

Array of tasks that wereaffected.

removeDependency Removesan existingdependencybetween two tasks.

Success or failure response.

TP00302 G Teamcenter Project API User’s Guide 1-9

Page 22: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-3. Task Service Functions

Function Name Description Expected Response

removeMemberTaskAssignment

Removes anassignmentbetween a memberand a task.

The assignment that wasremoved.

removeSubTask Removesthe subtaskrelationshipbetween two tasks.

Success or failure response.

removeSubTaskAffected Removesthe subtaskrelationshipbetween two tasks.

Array of tasks that wereaffected by removal of subtaskrelationship.

updateBillRateForTask

Updates the billrate for a task.

None.

updateFixedCostForTask

Gets the fixed costfor a task.

The updated task.

updateMemberTaskAssignment

Updates anassignmentbetween a memberand a task.

The updated assignment.

updateTask Updates an existingtask.

The updated task.

updateTaskAffected Updates an existingtask.

Array of tasks that wereaffected by updating the task.

approveTimesheetEntry Approves atimesheet entry

Success or failure response.

deleteTimesheetEntry Deletes a timesheetentry.

Success or failure response.

newTimesheetEntry Creates one or morenew timesheetentries.

The new timesheet entry (orentries).

queryTimesheetEntries Updates the fixedcost for a task.

The updated task.

updateTimesheetEntry Updates an existingtimesheet entry.

The updated timesheet entry.

1-10 Teamcenter Project API User’s Guide TP00302 G

Page 23: Tc Project a Pius Er Guide 50

Introduction

Table 1-4. Member Service Functions

Function Name Description Expected Response

deleteMember Deletes amember(person or skillset).

Success or failure response.

deletePerson Deletes aperson.

Success or failure response.

deleteSkillSet Deletes a skillset.

The deleted skill set.

deleteSkillSetMembership

Deletes askill setmembership.

The deleted membership.

getCurrentMember Gets themember whoestablished theAPI sessionbeing used forthis function.

The member.

getDefaultSkillLevel Gets the defaultskill level.

The default skill level.

getMemberByOid Gets member(person or skillset) by OID.

The member.

getMembersbyOidArray

Gets peopleand/or skill setsbased on arrayof their OIDs.

Array of members correspondingto the OIDs requested.

getMemberMappedToSkillSet

Gets personmapped to askill set.

The person.

getMemberOids Queries forthe OIDs forpeople or skillsets within aspecified folder.

Array of strings containing OIDsfor people in the specified folder.

getMembers Queries forpeople or skillsets within aspecified folder.

Array of members within aspecified folder.

getMembersAssignedToTask

Gets peopleor skill setsassigned to atask.

Array of members assigned to thetask.

getPeople Queries forpeople within aspecified folder.

Array of people within the specifiedfolder.

TP00302 G Teamcenter Project API User’s Guide 1-11

Page 24: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-4. Member Service Functions

Function Name Description Expected Response

getPeopleOids Queries forOIDs of peoplewithin aspecified folder.

Array of string containing OIDsfor people in the specified folder.

getPersonByOid Gets person bythe person’sOID.

The person.

getSkillLevels Gets skilllevels.

Array of skill levels.

getSkillSet Gets a skill set. The skill set.

getSkillSetsMappedToMember

Gets skill setsmapped aperson for aworkplace.

Array of members (skill sets)mapped to the person in aworkplace.

getSkillSetMembership Getsmembershipfor a skill set.

Array of memberships.

mapMemberToSkillSet Maps a personto a skill set.

The person that was mapped.

newMember Creates oneor more newmembers(people or skillsets).

The new members.

newPerson Creates oneor more newmembers.

The new members.

newSkillSetMembership Creates anew skill setmembership.

The new membership.

queryPeople Queries forpeople.

Array of people who meet thespecified query criteria.

querySkillSetMemberships

Queries forskill setmemberships.

Array of memberships.

querySkillSets Queries for skillsets.

Array of skill sets.

removeSkillSetMapping Removes themapping of aperson to a skillset.

The person that had been mapped.

updateMember Updates aperson or skillset.

The updated member.

1-12 Teamcenter Project API User’s Guide TP00302 G

Page 25: Tc Project a Pius Er Guide 50

Introduction

Table 1-4. Member Service Functions

Function Name Description Expected Response

updatePerson Updates aperson.

The updated person.

updateSkillSet Updates a skillset.

The updated skill set.

updateSkillSetMembership

Updates askill setmembership.

The updated membership.

TP00302 G Teamcenter Project API User’s Guide 1-13

Page 26: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-5. Security Service Functions

Function Name Description Expected Response

deleteSpecificSecuritySetting

Deletes thespecific securitysetting for amember for anobject.

XMLSecuritySetting that wasdeleted.

getOtherSecuritySetting

Gets thesecurity settingfor the othercategory of anobject.

XMLSecuritySetting for theother category.

getOwnerSecuritySetting

Gets thesecurity settingfor the owner ofan object.

XMLSecuritySetting for theowner.

getSecurity Gets allthe securitysettings for anobject.

XMLSecurity containing all theobject’s security settings.

getSpecificSecuritySetting

Gets thespecific securitysettings forone or moremembers for anobject.

XMLSecuritySetting(s).

setOtherSecuritySetting

Sets thesecurity settingfor the othercategory for anobject.

The XMLSecuritySetting forother for the object.

setOwnerSecuritySetting

Sets thesecurity settingfor the ownerfor an object.

XMLSecuritySetting for theowner for the object.

setSecurity Sets allthe securitysettings for anobject.

New security settings for theobject.

setSpecificSecuritySetting

Sets the specificsecurity settingfor a memberfor an object.

New XMLSecuritySetting for themember for the object.

1-14 Teamcenter Project API User’s Guide TP00302 G

Page 27: Tc Project a Pius Er Guide 50

Introduction

Table 1-6. Folder Service Functions

Function Name Description Expected Response

deleteFolder Deletes a folder. Updated copy of the parent of thedeleted folder.

getFolderByOid Gets a folderbased on itsOID.

The folder.

getFolderForObject Gets the folderthat containsthe specifiedobject.

The folder.

getFolders Gets one ormore folders.

Array of folders.

getFoldersByName Gets one ormore foldersbased on name.

Array of folders that matchspecified name.

getObjectOids Gets the OIDsof the objectscontained inspecified folder.

Array of strings of OIDs of objectsin folder.

getPath Gets the path offolders leadingto specifiedfolder.

Array of folders which representpath to the folder.

getRootFolder Gets the rootfolder.

The folder.

moveToFolder Moves an objectto anotherfolder.

The folder.

newFolder Creates a newfolder.

Array containing new folder plusupdated parent folder.

queryFolders Queries forfolders.

Zero or more folders that meet thequery specifications.

updateFolder Updates anexisting folder.

The updated folder.

TP00302 G Teamcenter Project API User’s Guide 1-15

Page 28: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-7. Document Service Functions

Function Name Description Expected Response

deleteDocument Deletes adocument(either specifiedversions or allversions).

None, or an array of documentmetadata.

downloadDocument Downloadsa singledocumentversion fromthe server.

The downloaded document plusdesired metadata.

getMetadataByDocumentName

Gets metadatafor documentsmatching aspecified name.

Array of matching documentmetadata.

getLauncherURLForDocument

Gets launcherURL for adocument.

A string containing the launcherURL for a document.

getMetadataByMetadatOid

Gets themetadata fora document,based on itsOID.

A document object containing themetadata.

getMetadataForWorkplace

Gets metadatafor documentsin a workplace.

Array of metadata.

newDocument Uploads a newdocument.

Metadata for new document.

queryMetadata Queries fordocumentmetadata.

Array of desired metadata.

updateMetadata Updates themetadata for adocument.

Array of updated metadata.

uploadDocument Uploads anew versionof an existingdocument.

Array of metadata.

1-16 Teamcenter Project API User’s Guide TP00302 G

Page 29: Tc Project a Pius Er Guide 50

Introduction

Table 1-8. Calendar Service Functions

Function Name Description Expected Response

deleteCalendar Deletes acalendar.

The deleted calendar.

deleteCalendarEvent Deletes oneevent for acalendar.

The updated calendar.

getCalendar Gets a calendarof any type.

The desired calendar.

newCalendarEvent Creates a newcalendar event.

The new calendar event.

queryCalendars Queries thedatabase forcalendars.

Zero or more calendars that meetthe query specification.

setCalendar Creates orreplaces acalendar.

The calendar which has been set.

updateCalendarEvent Updatesan existingcalendar event.

The updated calendar event.

TP00302 G Teamcenter Project API User’s Guide 1-17

Page 30: Tc Project a Pius Er Guide 50

Chapter 1 Introduction

Table 1-9. Link Service Functions

Function Name Description Expected Response

deleteExternalLink Deletes anexternal link.

The deleted link.

getExternalLinks Gets externallinks.

Array of external links.

getIconURI Gets the iconURI for a typeof object.

The icon URI.

newExternalLink Creates a newexternal link.

The new link.

1-18 Teamcenter Project API User’s Guide TP00302 G

Page 31: Tc Project a Pius Er Guide 50

Introduction

Table 1-10. Outline Service Functions

Function Name Description Expected Response

deleteTaskNotebook Deletes a tasknotebook.

The deleted notebook.

deleteTaskNotebookEntry Deletes a tasknotebook entry.

The deleted entry.

getTaskNotebook Gets a tasknotebook.

The task notebook.

moveTaskNotebookEntry

Moves a tasknotebook entry.

Array of entries that were affected.

newTaskNotebookEntry Adds a new tasknotebook entry.

Array of entries that were affected.

updateTaskNotebook Updates a tasknotebook.

The updated notebook.

updateTaskNotebookEntry

Updates a tasknotebook entry.

The updated entry.

TP00302 G Teamcenter Project API User’s Guide 1-19

Page 32: Tc Project a Pius Er Guide 50
Page 33: Tc Project a Pius Er Guide 50

Chapter

2 Standard Input Parameters

Standard Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

TP00302 G Teamcenter Project API User’s Guide

Page 34: Tc Project a Pius Er Guide 50
Page 35: Tc Project a Pius Er Guide 50

Chapter

2 Standard Input Parameters

Each function takes a set of input parameters unique to the function. There are alsoseveral input parameters that apply to a wide range function calls. Table 2-1 liststhe standard input functions.

Standard Input ParametersTable 2-1 lists the standard input parameters:

Table 2-1. Standard Input Parameters

Input Description

SessionID Specifies the client’s session ID that was acquired bycalling beginApiSession(). The SessionID is requiredfor all subsequent calls to functions.

When using the client library, the session is created andmaintained transparently. For more information aboutthe client library, see chapter 4, Using WSDL to Accessthe API.

xxxxxxVersion Specifies the version of an object before update. Verifiesthat no records overwrite changes made since the copyof the object was acquired.

Before updating an object, be certain you are workingthe most recent copy of the object.

queryData Generally specifies the WHERE clause of the SQL queryused to build the method results.

Use an empty string to return all records for a particularentity (such as workplaces or members).

OID Specifies the object ID that uniquely identifies anyobject (such as a workplace, task, member, membership,or timesheet entry).

Many functions and XML objects require an OID. Thenecessary OIDs can be obtained from responses toqueries on Teamcenter Project.

TP00302 G Teamcenter Project API User’s Guide 2-1

Page 36: Tc Project a Pius Er Guide 50
Page 37: Tc Project a Pius Er Guide 50

Chapter

3 Using the Java API ClientLibrary to Access the API

Java Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1

Secure Communications Using SSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

TP00302 G Teamcenter Project API User’s Guide

Page 38: Tc Project a Pius Er Guide 50
Page 39: Tc Project a Pius Er Guide 50

Chapter

3 Using the Java API ClientLibrary to Access the API

If you are developing your client application in Java™, you can use the Java clientlibrary included in the toolkit. This library, packaged as TCApiClient.jar, containsJava classes that handle the API’s SOAP message, allowing you to concentrate onyour project’s business logic instead of the details of SOAP.

To use TCApiClient.jar, you must include it in your client’s CLASSPATH, alongwith the other JAR files included in the toolkit (axis.jar, xmlParserAPIs.jar,xercesImpl.jar, saaj.jar, jaxrpc.jar, commons-discovery.jar,commons-logging.jar, log4j-[ver. no.].jar, mail.jar, and activation.jar).

If you are not using Java, or if you do not wish to use the Java API client library, goto chapter 4, Using WSDL to Access the API, to learn how to access the API.

Java ExampleWhile you are not required to use the Java API client library for a Java clientapplication, there are some advantages over the alternative approach (using WSDL).See table 3-1.

Table 3-1. Choices for a Java API Client Application

Java API Client Library WSDL

Java stubs (proxies) are already created. You create Java stubs (proxies) fromWSDL files, using the tool of your choice.

Enhanced support for documents,including reading/writing file onclient, compression/decompression, andattachment handling.

Standard support for documents.

Libraries for your clientapplication are included in thetoolkit (TCPApiClient.jar,axis.jar, xmlParserAPIs.jar,xercesImpl.jar, saaj.jar,jaxrpc.jar, commons-discovery.jar,commons-logging.jar, log4j-[ver.no.].jar, mail.jar, and activation.jar).

You include soap libraries from the toolof your choice (they must be compatiblewith Teamcenter Project’s SOAP).

Includes client logging capability toassist in debugging.

Debugging capability depends on toolused.

TP00302 G Teamcenter Project API User’s Guide 3-1

Page 40: Tc Project a Pius Er Guide 50

Chapter 3 Using the Java API Client Library to Access the API

Figure 3-1 illustrates a Java client program that:

• Establishes an API session.• Gets a task based on its OID.• Ends the API session.

import COM.inovie.teamCenter.api.client.*;import COM.inovie.teamCenter.api.xml.*;ApiConnection conn = null;try {

// Create a new connection object.conn = new ApiConnection();

// Open the connection to the server.conn.open("http://127.0.0.1:8000/ApiService", "user", "pass");

// Get the task service.TaskService taskSvc = conn.getTaskService();

// Get a task.XMLTask task = taskSvc.getTaskByOid("123456789");

// Set the status to "complete".task.setStatus(XMLTask.STATUS_COMPLETE);

// Update the task on the server.taskSvc.updateTask(task);

// Note that the connection is closed in the "finally" block.

} catch (ApiException aex) {// do something

} catch (Exception ex) {// do something else

} finally {// Close the connection to the server.if (conn != null) {

conn.close();}

Figure 3-1. Client Library Java Example

Consult the Javadocs included in the toolkit for complete information about theuse of the Java API client library. Examples for each API method are includedin the Javadocs.

3-2 Teamcenter Project API User’s Guide TP00302 G

Page 41: Tc Project a Pius Er Guide 50

Using the Java API Client Library to Access the API

Secure Communications Using SSLThe API supports secure communications through SSL (Secure Sockets Layer). Onceyou open a secure connection with the API by specifying https as the protocol in yourconnection string (such as https://localhost:8443/ApiService) on the client, allsubsequent calls to the API in the same session use SSL.

SSL needs to be enabled on both the Teamcenter Project web server and on your clientapplication that uses the API. Follow the directions provided with your web serverfor enabling SSL. You need to do the following to enable SSL API communications:

1. Verify that SSL is enabled on the web server.

2. Verify that your SSL libraries are in your client application’s CLASSPATH.

3. Verify that the keystore for SSL has been set up properly on both the client andweb server. You can use defaults if they meet your needs or else you can generateyour own keystore/certificates if required by your application.

4. Verify that there is a URL handler for https on the client.

5. Verify that there is an SSL provider available on the client.

6. Begin an API session with a URL specifying https on the client.

7. Execute API method calls as desired on the client.

Follow the directions provided with your web server on enabling SSL. Figure 3-2illustrates sample code for SSL communications using JSSE through the clientlibrary.

TP00302 G Teamcenter Project API User’s Guide 3-3

Page 42: Tc Project a Pius Er Guide 50

Chapter 3 Using the Java API Client Library to Access the API

import COM.inovie.teamCenter.api.client.*;import COM.inovie.teamCenter.api.xml.*;

...

public static void main(String args[]){

// This example assumes the use of the JSSE (Java Secure Socket Extension)// reference implementation. SSL usage from different vendors will// vary from this example.

// Specify the location of where to find key material for the default// TrustManager (this overrides jssecacerts and cacerts).// This line is necessary only if you are generating your own certificates.System.setProperty("javax.net.ssl.trustStore","D:\\myKeystore\\

clientKeystore");

// Use Sun’s jsse reference implementation of a URL handler for the"https" URL protocol type

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

// Dynamically register sun’s jsse ssl providerSecurity.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

// Create a new connection objectApiConnection conn = new ApiConnection();try {

// Upon success opening a connection return a new sessionIDString sessionID = conn.open("https://146.122.102.129:8443/

ApiService", API_LOGIN, API_PWD);

// If we didn’t get a sessionID back then the call failedif(sessionID.equals("")) {

System.err.println("Unable to create a new session...");// do some error handling

}

// Get the task serviceTaskService taskSvc = conn.getTaskService();

// Query for our taskXMLTask task = taskSvc.getTaskByOid("1001085938985");

// (The connection will be closed in the finally block)} catch (ApiException aex) {

// do some error handling} catch(Exception e) {

// do some error handling} finally {

// Close the connectionif (conn != null) {conn.close();

}}

}

Figure 3-2. SSL Sample Code

3-4 Teamcenter Project API User’s Guide TP00302 G

Page 43: Tc Project a Pius Er Guide 50

Chapter

4 Using WSDL to Access the API

C# Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

Needed Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

Secure Communications Using SSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

TP00302 G Teamcenter Project API User’s Guide

Page 44: Tc Project a Pius Er Guide 50
Page 45: Tc Project a Pius Er Guide 50

Chapter

4 Using WSDL to Access the API

If you are using a language other than Java for your client application that accessesthe API, or if you prefer to generate your own Java stubs (proxies), read this section.If you are using Java and want to use the provided Java API client library, refer tochapter 3, Using the Java API Client Library to Access the API.

The API toolkit includes WSDL (Web Services Definition Language) files for theservices available through the API. The WSDL files include all the information youneed to call the methods in the API from your client program. Generally, you cangenerate proxy programs from these WSDL files that you can use with your clientprogram. The proxies help take care of the SOAP messaging for you so that you canconcentrate on your project’s business logic. You should determine the utilities youneed to generate the proper proxies for your development environment. Microsoft, forinstance, provides a utility called wsdl which generates C# or Visual Basic proxiesfrom the WSDL files for the .NET environment. Other Java tools such as Apache’sWSDL2Java create Java client files from WSDL.

When you generate proxies from the WSDL, remember that the WSDL files containdefault addresses for the port binding (such as http://localhost:8000/ApiService).You need to make sure your client program uses the proper IP address, port, etc. foryour Teamcenter Project server installation instead of localhost:8000.

With the proxies, you can write your client program to deal with the API as if it werecalling local methods.

Clients using WSDL to access the API must track the Session ID themselves. Youmust pass the Session ID as the first parameter for every function call except forbeginApiSession(). So to call getTaskByOid() from a client not using the library, youwould supply two arguments:

argument 1: string Session ID (the value was obtained previouslyas the value returned in the call to beginApiSession())argument 2: string taskOid (the OID for the desired task)

Notice how this is done in the following C# example.

The Java API Client library works differently. With the Java API Client library, toget a task by its OID, you call the appropriate method in the TaskService class. Youdo not need to pass the Session ID as a parameter, since the library tracks it for you:

public XMLTask getTaskByOid(String taskOid) throws ApiException;

For details on all functions, their parameters, and their returns, refer to the WSDLfiles and to the Javadocs. The Javadocs provide a detailed description of eachfunction (method), plus sample source code. Remember that the sessionID is notprovided for you if you are not using the Java API Client Library.

TP00302 G Teamcenter Project API User’s Guide 4-1

Page 46: Tc Project a Pius Er Guide 50

Chapter 4 Using WSDL to Access the API

C# ExampleFigure 4-1 illustrates a C# client program that:

• Establishes an API session.• Gets a task based on its OID.• Ends the API session.

// Allow easy reference to classes in the System namespaceusing System;

// This "class" exists only to house the application’s entry-point functionclass MainApp {

// Static method called "Main" is application’s entry point functionpublic static void Main() {

try {// Begin an API session.TCSessionService tcSessionService = new TCSessionService();string sessionID = tcSessionService.beginApiSession("login", "password", "5.0");

// Get task and update status.TCTaskService tcTaskService = new TCTaskService();XMLTask task = tcTaskService.getTaskByOid(sessionID, "123456789");task.status = "Complete";tcTaskService.updateTask(sessionID, task.tcOid, task.version, task);

// End session.tcSessionService.endApiSession(sessionID);

} catch (Exception ex) {// Do something

}}

}

Figure 4-1. Client Library C# Example

Figure 4-2 shows a sample proxy for Session Services that is generated by Microsoft’swsdl utility (this proxy is not included in the toolkit—you must generate your own).

4-2 Teamcenter Project API User’s Guide TP00302 G

Page 47: Tc Project a Pius Er Guide 50

Using WSDL to Access the API

//// This source code was auto-generated by wsdl, Version=1.0.3705.0.//using System.Diagnostics;using System.Xml.Serialization;using System;using System.Web.Services.Protocols;using System.ComponentModel;using System.Web.Services;

/// <remarks/>[System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Web.Services.WebServiceBindingAttribute(Name="TCPSessionServiceSoapBinding",Namespace="urn:TCPSessionServices")]public class TCPSessionService : System.Web.Services.Protocols.SoapHttpClientProtocol {

/// <remarks/>public TCPSessionService() {

this.Url = "http://localhost:8000/ApiService";}

/// <remarks/>[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace=

"urn:TCPSessionServices", ResponseNamespace="urn:TCPSessionServices")][return: System.Xml.Serialization.SoapElementAttribute("return")]public string beginApiSession(string login, string password, string version) {

object[] results = this.Invoke("beginApiSession", new object[] {login,password,version});

return ((string)(results[0]));}

/// <remarks/>public System.IAsyncResult BeginbeginApiSession(string login, string

password, string version, System.AsyncCallback callback, object asyncState) {return this.BeginInvoke("beginApiSession", new object[] {

login,password,version}, callback, asyncState);

}

/// <remarks/>public string EndbeginApiSession(System.IAsyncResult asyncResult) {

object[] results = this.EndInvoke(asyncResult);return ((string)(results[0]));

}

Figure 4-2. Sample Proxy (Continued)

TP00302 G Teamcenter Project API User’s Guide 4-3

Page 48: Tc Project a Pius Er Guide 50

Chapter 4 Using WSDL to Access the API

/// <remarks/>[System.Web.Services.Protocols.SoapRpcMethodAttribute("",

RequestNamespace="urn:TCPSessionServices", ResponseNamespace="urn:TCPSessionServices")]

[return: System.Xml.Serialization.SoapElementAttribute("return")]public bool endApiSession(string sessionID) {

object[] results = this.Invoke("endApiSession", new object[] {sessionID});

return ((bool)(results[0]));}

/// <remarks/>public System.IAsyncResult BeginendApiSession(string sessionID,

System.AsyncCallback callback, object asyncState) {return this.BeginInvoke("endApiSession", new object[] {

sessionID}, callback, asyncState);}

/// <remarks/>public bool EndendApiSession(System.IAsyncResult asyncResult) {

object[] results = this.EndInvoke(asyncResult);return ((bool)(results[0]));

}}

Figure 4-2. Sample Proxy

The sample proxy was created from the WSDL file shown in figure 4-3. This file isone of the WSDL files included in the toolkit.

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="urn:TCPSessionServices" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap"xmlns:impl="urn:TCPSessionServices-impl" xmlns:intf="urn:TCPSessionServices"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:TCPApiServices" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema targetNamespace="urn:TCPApiServices" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="ApiException"><sequence><element name="faultString" nillable="true" type="soapenc:string"/><element name="serviceName" nillable="true" type="soapenc:string"/><element name="methodName" nillable="true" type="soapenc:string"/><element name="errorCode" type="xsd:int"/><element name="detailedDescription" nillable="true" type="soapenc:string"/><element name="stackTrace" nillable="true" type="soapenc:string"/><element name="exceptionFaultCode" nillable="true" type="soapenc:string"/></sequence>

</complexType><element name="ApiException" nillable="true" type="tns1:ApiException"/>

</schema></wsdl:types>

Figure 4-3. WSDL File (Continued)

4-4 Teamcenter Project API User’s Guide TP00302 G

Page 49: Tc Project a Pius Er Guide 50

Using WSDL to Access the API

<wsdl:message name="endApiSessionResponse">

<wsdl:part name="return" type="xsd:boolean"/>

</wsdl:message>

<wsdl:message name="endApiSessionRequest">

<wsdl:part name="sessionID" type="soapenc:string"/>

</wsdl:message>

<wsdl:message name="beginApiSessionRequest">

<wsdl:part name="login" type="soapenc:string"/>

<wsdl:part name="password" type="soapenc:string"/>

<wsdl:part name="version" type="soapenc:string"/>

</wsdl:message>

<wsdl:message name="ApiException">

<wsdl:part name="fault" type="tns1:ApiException"/>

</wsdl:message>

<wsdl:message name="beginApiSessionResponse">

<wsdl:part name="return" type="soapenc:string"/>

</wsdl:message>

<wsdl:portType name="TCPSession">

<wsdl:operation name="beginApiSession" parameterOrder="login password version">

<wsdl:input message="intf:beginApiSessionRequest" name="beginApiSessionRequest"/>

<wsdl:output message="intf:beginApiSessionResponse" name="beginApiSessionResponse"/>

<wsdl:fault message="intf:ApiException" name="ApiException"/>

</wsdl:operation>

<wsdl:operation name="endApiSession" parameterOrder="sessionID">

<wsdl:input message="intf:endApiSessionRequest" name="endApiSessionRequest"/>

<wsdl:output message="intf:endApiSessionResponse" name="endApiSessionResponse"/>

Figure 4-3. WSDL File (Continued)

TP00302 G Teamcenter Project API User’s Guide 4-5

Page 50: Tc Project a Pius Er Guide 50

Chapter 4 Using WSDL to Access the API

<wsdl:fault message="intf:ApiException" name="ApiException"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="TCPSessionServiceSoapBinding" type="intf:TCPSession">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="beginApiSession">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="beginApiSessionRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TCPSessionServices" use="encoded"/>

</wsdl:input>

<wsdl:output name="beginApiSessionResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TCPSessionServices" use="encoded"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="endApiSession">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="endApiSessionRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TCPSessionServices" use="encoded"/>

</wsdl:input>

<wsdl:output name="endApiSessionResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TCPSessionServices" use="encoded"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="TCPSessionService">

<wsdl:port binding="intf:TCPSessionServiceSoapBinding" name="TCPSessionService">

<wsdlsoap:address location="http://localhost:8000/ApiService"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Figure 4-3. WSDL File

4-6 Teamcenter Project API User’s Guide TP00302 G

Page 51: Tc Project a Pius Er Guide 50

Using WSDL to Access the API

Needed ConstantsThe WSDL files specify the syntax for the API services you use, but they do notspecify the values of certain parameters you need in your calls to the API. Examplesof some of the parameters are status values for tasks and workplaces and taskdependency types.

Consult the Javadocs for descriptions and literals for all constants used by the API.

Secure Communications Using SSLThe API supports secure communications through SSL (Secure Sockets Layer). Onceyou open a secure connection with the API by specifying https as the protocol in yourconnection string (such as https://localhost:8443/ApiService) on the client, allsubsequent calls to the API in the same session use SSL.

SSL needs to be enabled on both the Teamcenter Project web server and on yourclient application that uses the API. Follow the directions provided with your webserver on enabling SSL. For your client application, make sure that SSL supportis provided on the client and that the SSL keystore has been set up properly foryour particular client platform.

TP00302 G Teamcenter Project API User’s Guide 4-7

Page 52: Tc Project a Pius Er Guide 50
Page 53: Tc Project a Pius Er Guide 50

Chapter

5 Debugging the ClientApplication

API Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1Server-Side API Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1Client-Side API Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

Third-Party TCP Trace Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

TP00302 G Teamcenter Project API User’s Guide

Page 54: Tc Project a Pius Er Guide 50
Page 55: Tc Project a Pius Er Guide 50

Chapter

5 Debugging the ClientApplication

When you debug your client API application, you might find it useful to use the APIlog feature or other third-party tools. These aids are described in this chapter.

API LoggingThe API can log events for both the client and the server. Separate log files canbe kept on the server and on your client. When you enable logging, the APIautomatically logs events. You can also add your own messages on the client side.

For the client, the API log is available through the Java client. For the server, youcan enable the API log regardless of the client you are using.

Server-Side API Logging

To start logging API events on the server, use the JDOT Server Administrationprogram to enable API logging, just as you would do for other categories of Projectlogging.

1. Open the JDOT Server Administration program

2. Click the Log tab.

3. To enable API logging, click API Logging Enabled. To turn off API logging,clear the API Logging Enabled box.

4. Select a Log Level. The Log Level selection controls the amount of informationthat is saved to the API log. See the Teamcenter Project System Administrator’sManual for details.

5. After you change the setting, you must restart the JDOT server.

TP00302 G Teamcenter Project API User’s Guide 5-1

Page 56: Tc Project a Pius Er Guide 50

Chapter 5 Debugging the Client Application

Client-Side API Logging

You can programmatically control the API log on the client side if you are using theJava client. Use the beginLogging, logMessage, and endLogging methodsprovided in the ApiConnection. Once you call beginLogging with a level otherthan Disabled, the API log captures events appropriate for the level suggested. Youcan also add your own messages to the log at any time after calling logMessage. Becareful when specifying the Debug level because it can generate a large numberof entries in the log.

For details regarding Java syntax, consult the Javadocs for the ApiConnectionand ApiLog classes.

Figure 5-1 shows a sample code segment that uses the log.

String addr = "http://127.0.0.1:8080/ApiService";ApiConnection conn = null;try {

conn = new ApiConnection();conn.beginLogging("c:\\mylog.txt", ApiLog.INFO_LEVEL);conn.open("http://127.0.0.1:8000/ApiService", "admin", "pw");XMLWorkplace[] workplaces = ws.queryWorkplaces("WHERE tcname= ’Test Workplace’");conn.endLogging();

} catch (ApiException ex) {ex.printStackTrace();

} finally {if (conn != null) {

conn.close();}

Figure 5-1. Sample Client-Side API Logging

After executing the code, the log contains entries like those shown in figure 5-2.

[Fri Apr 16 10:32:50 PDT 2004] ApiLog, began logging at Info, version 4.1.0

[Fri Apr 16 10:32:50 PDT 2004] ApiConnection.beginApiSession,strTargetURL=http://127.0.0.1:8000/ApiService, loginName=admin

[Fri Apr 16 10:32:50 PDT 2004] sessionID=7327859395074513 ApiConnection.beginApiSession, , returning 7327859395074513

[Fri Apr 16 10:32:50 PDT 2004] sessionID=9871104512919878 WorkplaceService.queryWorkplaces, queryData= WHERE tcname= ’Test Workplace’

[Fri Apr 16 10:32:52 PDT 2004] sessionID=9871104512919878 WorkplaceService.queryWorkplaces, returning [0]=[tcOid=1076424576676, startDate=TueMar 09 04:00:00 PST 2004, deadline=Mon Mar 22 04:00:00 PST 2004,workplaceName=Test Workplace, description=, version=8,priority=Medium, status=Not Started, customerName=, customerNumber=,published=true, datesLinked=false, percentLinked=false, template=false, billcode1=<unassigned>, billcode2=<unassigned>, billcode3=<unassigned>, teamWebUrl=,customField1=, customField2=, customField3=, customField4=, customField5=,customField6=, customField7=, customField8=, customField9=, customField10=]

[Fri Apr 16 10:32:52 PDT 2004] ApiLog, ended logging

Figure 5-2. Sample Client Log Entries

5-2 Teamcenter Project API User’s Guide TP00302 G

Page 57: Tc Project a Pius Er Guide 50

Debugging the Client Application

If you had logging enabled on the server at the same time, you see entries in thelog file on the server like those shown in figure 5-3.

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:50) DefaultApiSessionHandler::beginApiSession: none login=admin, locale=null, version=4.1.0

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:50) DefaultApiSessionHandler::beginApiSession: none activeSessionCount on entry=1

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:50) DefaultApiSessionHandler::beginApiSession: 7327859395074513 returning 7327859395074513

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:50) DefaultApiSessionHandler::beginApiSession: 7327859395074513 remote address=127.0.0.1

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:51) DefaultApiWorkplaceHandler::queryWorkplaces: 9871104512919878 queryData= WHERE tcname= ’Test Workplace’

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:52) DefaultApiWorkplaceHandler::queryWorkplaces: 9871104512919878 returning [0]=[tcOid=1076424576676, startDate=Tue Mar 09 04:00:00 PST 2004, deadline=Mon Mar 22 04:00:00 PST 2004,workplaceName=Test Workplace, description=, version=8,priority=Medium, status=Not Started, customerName=, customerNumber=,published=true, datesLinked=false, percentLinked=false, template=false,billcode1=<unassigned>, billcode2=<unassigned>, billcode3=<unassigned>,teamWebUrl=, customField1=, customField2=, customField3=, customField4=,customField5=, customField6=, customField7=, customField8=,customField9=, customField10=]

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:52) DefaultApiSessionHandler::endApiSession: 7327859395074513

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:52) DefaultApiSessionHandler::endApiSession: 7327859395074513 activeSessionCount on entry=2

4/16/2004 10:33:09 (Actual Time - 4/16/2004 10:32:52) DefaultApiSessionHandler::endApiSession: 7327859395074513 remote address=127.0.0.1

Figure 5-3. Sample Server Log Entries

By inspecting the log files and matching up events on the client and the server, youcan diagnose the source of a problem. Remember, timestamps are local to the clientand server machines, so they may not match perfectly.

Third-Party TCP Trace ToolAlternative debugging tools, obtained from third-party vendors, can be used to tracethe traffic between your client and server. With some of these tools, you can visuallyinspect the SOAP messages that are exchanged.

These kinds of tools can be valuable, especially if you are dealing with SOAP/XMLyourself and are not using the Java client. UGS does not provide this kind of tool.

TP00302 G Teamcenter Project API User’s Guide 5-3

Page 58: Tc Project a Pius Er Guide 50
Page 59: Tc Project a Pius Er Guide 50

Index

A

API loggingClient-side logging . . . . . . . . . . . . . . . . . 5-2Description . . . . . . . . . . . . . . . . . . . . . . 5-1JDOT Server Administration . . . . . . . . . . 5-1Server-side logging . . . . . . . . . . . . . . . . 5-1

B

beginLogging method . . . . . . . . . . . . . . . . 5-2

C

Client library, C# example . . . . . . . . . . . . . 4-2Client-side API logging . . . . . . . . . . . . . . . 5-2Code conventions . . . . . . . . . . . . . . . . . . . . 6Command line entry conventions . . . . . . . . . 6Conventions

Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Command line entries . . . . . . . . . . . . . . . 6File contents . . . . . . . . . . . . . . . . . . . . . . 6Names . . . . . . . . . . . . . . . . . . . . . . . . . . 6Values . . . . . . . . . . . . . . . . . . . . . . . . . . 6

D

Debugging client applications . . . . . . . . . . . 5-1

E

endLogging method . . . . . . . . . . . . . . . . . 5-2

F

File contents conventions . . . . . . . . . . . . . . . 6

J

Java API client library . . . . . . . . . . . . . . . 3-1Java example . . . . . . . . . . . . . . . . . . . . . . 3-1

L

logMessage method . . . . . . . . . . . . . . . . . . 5-2

M

MethodsbeginLogging . . . . . . . . . . . . . . . . . . . . 5-2endLogging . . . . . . . . . . . . . . . . . . . . . 5-2logMessage . . . . . . . . . . . . . . . . . . . . . . 5-2

N

Name conventions . . . . . . . . . . . . . . . . . . . 6

O

Objects, performing operations on . . . . . . . . 1-2

S

Secure Communications using SSL . . . . 3-3, 4-7Server-side API logging . . . . . . . . . . . . . . . 5-1Standard input parameters . . . . . . . . . . . . 2-1

T

Teamcenter ProjectCommunicating with . . . . . . . . . . . . . . . 1-3

Teamcenter Project APIIntroduction . . . . . . . . . . . . . . . . . . . . . 1-1Operations available in . . . . . . . . . . . . . 1-4

Third-party TCP trace tools . . . . . . . . . . . . 5-3

U

Using SSL . . . . . . . . . . . . . . . . . . . . . 3-3, 4-7

V

Value conventions . . . . . . . . . . . . . . . . . . . . 6

W

Web Services Definition LanguageNeeded constants . . . . . . . . . . . . . . . . . 4-7Using . . . . . . . . . . . . . . . . . . . . . . . . . 4-1

wsdl utility . . . . . . . . . . . . . . . . . . . . 4-1–4-2

TP00302 G Teamcenter Project API User’s Guide Index-1


Recommended