Saturday, February 9, 2013

Teamcenter SOA : Detail Steps for SOA Creation


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
Note:-

  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. 

8 comments:

  1. 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

    ReplyDelete
    Replies
    1. Hi,

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

      Delete
  2. Very good and deatiled explanation by manoj

    ReplyDelete
  3. Hi Karl-hopper,


    Even i have the same issue , can you please let me know if you could fix the issue that you were having

    ReplyDelete
  4. 1. soa_client version mut match the installed version.
    2. If SOA is using your DLL then Build your DLL in release mode

    ReplyDelete
  5. Hello,
    I'm new to SOA.
    I'm facing one problem in SOA while creating new custom Service, below is description:
    After selecting the library created (D4SoaTest) Select GenerateCode->Service Artifacts

    I'm getting one error, here is this:

    **** Build of configuration Preference Configuration for project Learn_SOA ****


    (Cannot run program "nmake" (in directory "E:\Siemens\Teamcenter83\bmide\workspace\8000.3.0\Learn_SOA"): CreateProcess error=2, The system cannot find the file specified)

    Please let me know how to resolve this issue.

    Thanks in Advance.

    ReplyDelete
  6. Hi, Can you please let me know how to call custom exit from custom/ OOTB service. i have created the custom service according to the steps u have given but i do not have much idea on wht to add in cc++ code, is it possible to have the code only in java

    ReplyDelete
  7. Hello generally when u write a code in bmide it gets difficult to debug your code.
    so prefer to build code in visual studio. and its bit easy than this

    ReplyDelete