You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.3 KiB

//==================================================
//
// Copyright 2017 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
//
//==================================================
using System;
using Teamcenter.ClientX;
using User = Teamcenter.Soa.Client.Model.Strong.User;
namespace Teamcenter.RuntimeBO
{
/**
* This sample client application demonstrates some of the basic features of the
* Teamcenter Services framework and Runtime Business Objects.
*
* An instance of the Connection object is created with implementations of the
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
* intefaces. This client application performs the following functions:
* 1. Establishes a session with the Teamcenter server
* 2. Create an instance of a runtime business object
* 3. Set property values on the Runtime Business object
* 4. Retrieve values from the properties of the Runtime Business object
*
*/
public class Hello
{
/**
* @param args -help or -h will print out a Usage statement
*/
public static void Main(string[] args)
{
String serverHost = "http://localhost:7001/tc";
if (args.Length > 0)
{
if (args[0].Equals("-help") || args[0].Equals("-h"))
{
System.Console.Out.WriteLine("usage: Hello [-host http://server:port/tc]");
return;
}
if (args[0].Equals("-host") && args.Length > 1)
{
// Get optional host information
serverHost = args[1];
}
}
try
{
Session session = new Session(serverHost);
DataManagement dm = new DataManagement();
// Establish a session with the Teamcenter Server
User user = session.login();
dm.createRuntimeBO();
// Terminate the session with the Teamcenter server
session.logout();
}
catch (SystemException e)
{
Console.WriteLine(e.Message);
}
}
}
}