Teamcenter PLM


This blog provides detail steps of creating your own SOA. The SOA service provides all the query present in Teamcenter Query Builder. The SOA has one Operation which gat all query object in Teamcenter. The Operation doesn't take any input argument, it return list of Query Objects encapsulated in custom Data Structure.


Detail Steps :
  1. Create a new service library in BMIDE Extensions tab by selecting Project ->Code Generation->Services
  1. Select the newly created service library (Ex: D4SoaTest) and create new service
  2. Open the new service (Ex: ServiceTest)
  3. Define the DataTypes and Operations as per the requirement. Ex: Operation is to get all the saved queries. Define Data Types as below
Define data type TestQueryObject
    1. Click on Add button in the Data Types tab
    2. Select Structure and click Next
    3. Enter name as TestObjectQuery and description for it
    4. Select DataType elements by clicking Add button
    query->Teamcenter::ImanQuery [holds the query tag] queryname->std::string [holds the name of the query] querydescription->std::string [holds the description of the query]

    Define data type TestGetSavedQueriesResponse – Used for as return data type in operation which returns vector of query objects holding query tag, name and description

      1. Click on Add button in the Data Types tab
      2. Select Structure and click Next
      3. Enter name as TestGetSavedQueriesResponse and description for it
      4. Select DataType elements by clicking Add button
      queries->Vector of TestQueryObject services->Teamcenter::Soa::Server::ServiceData
      1. Create Operation using the above defined data type. Select Operations tab of the service (Ex Test Service). Click Add on to create new operation.
        1. Click on Browse button of New Service Operation dialog
        2. Select D4::Soa::Test::_2012_02::TestService::TestGetSavedQueriesResponse as the return data type
        3. Enter Service Operation Name: testGetSavedQueries
        4. Enter Service Operation Description: SOA Operation for getting Query List
        5. Enter Return Description: List of Query Object in Teamcenter
        6. Click on Finish
        1. Once the Operation is created, in Operation Tab when Service is opened.
        2. Save the datamodel.
        3. Select the library created (D4SoaTest). Select GenerateCode->Service Artifacts
        1. Check the Console view to know if the code generation is successful or errors in other case.
        2. Source and header files corresponding to each service are created. They are placed in the following path in Navigator view:
        Project->src->server->LibraryName

        Ex: AccentureTest->src->server->D4SoaTest (This folder contains the files which need to be implemented by the developer)

        Project->output->client->LibraryName - This contains the auto generated files for the client (no changes required to these files)

        Project->output->server->LibraryName - This contains the auto generated files for the server(no changes required to these files)

        Project->output->types->LibraryName - This contains the auto generated files for the data types that are created. (no changes required to these files)

        Inferences:
        1. Name of the service library: D4SoaTest
        2. Services in the library D4SoaTest:
        1. TestService
        1. Operations in the service by name TestService :
        1. testGetSavedQueries
        1. Open the source file and enter the required code. Shown below is the file generated in the step #8. Operation ‘testGetSavedQueries’ is high lightened for a quick notice.
        1. Build the project. Dlls are generated in
          1. Project \output\client\jars ( Project \output\types \lib if its c++ bindings) – jars files to added to java client classpath
          2. Project \output\server\lib (libraries which would be copied to Teamcenter Server TC_ROOT\bin)
          3. Project \output\types\jars ( Project \output\types\lib if its c++bindings) contains the types definition – jars files to added to java client classpath
          1. Check console to see a successful build message
          2. libD4soatypes.dll under types\lib and server\lib are same.
          3. Ensure the dependant libraries are added to the library definition. Ex: query module is used in the D4SoaTest library and hence added to the D4SoaTest library definition.
          1. Deploy the data model. This will deploy the library, service and operation definitions in the template to the database as well as it copies the built server libraries to TC_ROOT\bin. Ex Project \output\server\lib to TC_ROOT\bin
          You can now call your SOA at client site in a same way as you called sample SOA. Teamcenter SOA : Introduction
          Teamcenter SOA : Using OOTB SOA Services Temcenter SOA : Sample SOA Code Setup
          Teamcenter SOA : Create You Own SOA Posted by Manoj Tiwari at 10:29 AM

          11 comments:

          Hello,
          first I have to say that your Posts are great and helped me a lot! Thank you for the information and keep up with the good work!
          I tried to create a custom service for my Teamcenter 9.1 4-Tier test system. I followed your steps and created a simple service that has just one operation that returns a boolean value.
          I created service call in the sample HelloTeamcenter java application. The already implemented standard Teamcenter services such as listing the home folder contents etc. work nice but my custom service always returns the same error:

          ERROR com.teamcenter.soa.internal.client.RestSender - Teamcenter server is not reachable. Starting a new client session might resolve the problem.
          Server-side Exception:COMM_FAILURE

          ERROR com.teamcenter.soa.internal.client.RestSender - The response XML:

          Teamcenter server is not reachable. Starting a new client session might resolve the problem.
          Server-side Exception:COMM_FAILURE

          I the DLLs exist on the server. I copied them manually after deploying the template. I also tried to create a packaging template as stated in the Business Modeler IDE Guide and installed it via TEM.bat on the server but I always get this error. If I call the method from the SessionService to list all available services, my custom service is also in the list.

          Can you help me? I don't know what to do now or what I am doing wrong. Thank you very much in advance, sir!

          My System:
          TC 9.1.2 4-Tier server (vmware) on Windows Server 2008 64Bit
          TC 9.1.2 64Bit local client
          Visual Studio 2008 SP1
          JDK 6 Reply Delete

          Were able to fix the issue ? if so can you please let me know how Delete