Saturday, February 9, 2013

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 :

Create a new service libraryin BMIDE Extensions tab by selecting Project->Code Generation->Services

Select the newly created service library (Ex: D4SoaTest) and create new service

Open the new service (Ex: ServiceTest)

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

Click on Add button in the Data Types tab

Select Structure and click Next

Enter name as TestObjectQuery and description for it

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

Click on Add button in the Data Types tab

Select Structure and click Next

Enter name as TestGetSavedQueriesResponse and description for it

Select DataType elements by clicking Add button

queries->Vector of TestQueryObject

services->Teamcenter::Soa::Server::ServiceData

Create Operation using the above defined data type. Select Operations tab of the service (Ex Test Service). Click Add on to create new operation.

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.

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.

In my last two blog I discussed about basic fundamental of SOA and how to use OOTB SOA in client side. In this blog we will discuss about basic for creating your own SOA. Usually new SOA service is required to be created when you don’t find OOTB SOA satisfying your requirement or what to have the service behavior in different way. Following are the guideline for creating your own SOA.

1)Check whether you can achieve the required result at client side by using OOTB SOA.

2)Analyze the desire state of transaction between Client and SOA server layer. For example you have to look whether transaction should be committed in one request or multiple request provide by OOTB SOA is acceptable.

3)Analyze what service you want to implement. Whether it will be single request base or multiple requests which satisfy the use case.

4)Analyze what input to perform the service. This will help in defining input data type.

5)Analyze what output will be provided for requested service and how the output will be used. This will also help in deciding whether you required having loose or strong binding.

Before You Start:

Before start you should understand some aspect of SOA service in teamcenter.

Loose vs. Strong Binding: The binding define how the data map between SOA server and Client. Loose binding mean Key/Value pair mapping as string map of data and its value. Whereas strong binding means the client data model is populated with typed objects that correspond one-to-one with their server-side object type. Hence decision required to be taken based on use case. For example if SOA service is for creating some static reports then loose Binding can be good option and for integration strong binding is good option.

Data Type:

Data Type defined encapsulation of Data while creating a request for SOA service as well getting output from SOA service.In SOA you can define data type either of Structure, Map or Enumeration. Meanings of this Data Types are same as in a programming language like C or Java. Structure defines set of basic data types encapsulated in structure. Similarly Map is data container.

Operations:

Operation defines set of function which will available to client for created a request for services to be performed. The SOA service can be either defined through single operation if it is a simple service or set of Operation if it is a complex use case.

Creating SOA services:

As you understand the basic building block of creating SOA, we are ready for creating your own SOA service in the BMIDE. The detail of steps of creating SOA service is given in this blog. Following are the steps of creating SOA service

1)Define preference binding. For example for Java you can select loose or strong binding.

2)Create new SOA service library or use existing if you already have one.

3)Create new service under SOA service library.

4)Define all the data type which will be used for SOA Operation.

5)Defined all the Operations with define data type. The Operation will have input data type and return data types. Data Type can be either defined data type or OOTB data types.

6)Generate code in BMIDE by selecting Generate Code -> Service Artifacts. This will create stub code for both server and client side (see step blog for detail).

7)Implement the server side code for all defined operation in BMIDE. The stubs for all Operation is already created by BMIDE and only required to implement the business logic for the Operation.Server side implementation is always in C++ and ITK API can be used for implementation.

8)No implementation is required at client side.

9)Build the BMIDE project. Jar file created for the client (if it is Java Binding) and dll for server.

10)Deploy the server dll in TC_ROOT\bin directory.

11)Implement custom SOA service in client side. The process is same as defined for OOTB service in the Blog. Only addition will be to add the client SOA jar file in the Class path for using Java client and client dll if using c++ binding.

The detail steps is given in Steps
for creating SOA.

These close my series on
Teamcenter SOA. I thanks my friend Bhaskar for introducing me to Teamcenter SOA Framework.
Hope this blogs will help good foundation for all people who want to learn Teamcenter SOA servicesand serve as quick start on for using and
creating own services.