Thursday, 17 July 2014

SIEBEL: Web Service, WSDL and Namespace Explained ..

Siebel has a lot of options to integrate with other applications. I am going to discuss about Web Services in this post. This post contains generic concepts that may not be related specifically to Siebel.

A Web Service is, as the name says is a Web based Service using which we can send and receive data. A Web Service is defined in a standard format called Web Service Definition Language (WSDL). WSDL is written in XML. 

Basically WSDL contains the definition of the Service, which URL to call, what is the type and format of inputs and outputs to the Service etc. You can get a good idea about WSDL here

The basic components of a WSDL are 


1. types - Data types of input or output arguments of the service. They have simple data types like String, Number as well as complex hierarchical data types. They are defined in XML schema standards. When we import a web service in siebel, external integration objects will get created. If you generate schema of the IO structure as XML Schema, you will basically get the same as types section of the WSDL you imported. Try to compare this.



2. message - Message tags contain the business service arguments. They will refer the defined types above. This will actually refer the input and output arguments of a proxy business service when we import the WSDL.


3. portType - Port Type is the reference to the operations we perform when we execute a Web Service. This refers to the Methods of the proxy business service and its input and output arguments.


4. binding - Binding denotes the type of protocol used to call and the style of the transport of arguments. We use SOAP protocol to communicate using HTTP as type of transport in this scenario. Basically SOAP is Simple Object Access Protocol which is a standard set of rules that many systems use to communicate. I will write another post about the available binding options and the styles of transport. For the moment, I am using a document style with arguments sent as literal texts rather than encoding the data.

5. Service definition - Finally we give the details of the service like the available ports and their end points.


So basically we can correlate the Web Service call similar invoke a business service internally in siebel as below.

Imagine that I am calling a Siebel Business service, I'll write code as below. The same thing can be compared to a Web Service call.

Input = TheApplication().NewPropertySet();
Output = TheApplication().NewPropertySet(); 
ChildProperty = TheApplication().NewPropertySet();
Input.AddProperty("Name","Value");
Input.AddChild(ChildProperty);
TheApplication().GetService("Test").InvokeMethod("Abc", Input, Ouput);

Input, Output and child property Type of data and Structure in first 5 lines refers to <Types>
The Input, Output in the last line refers to <message> . Abc method can be referenced to <portType>
Test is the <Service Definition>
The only missing item is SOAP binding with HTTP transport which is a way to interact with external source.

Name Space: We have another element within the Web Services called NameSpace. NameSpace is nothing but a unique identifier given to differentiate similar objects. I can have two Web Services with same names but different namespaces. 



Imagine that I have an XML with data like this:

<Account>
<Id>1-ABC</Id>
<Contact>
<Id>1-QWE</Id>
<Contact>
</Account>

Now if I tell you to give me the Id value from this XML, can you get the value? You will ask me which Id I need, Account's or Contact's. Similarly a system will also get confused to get Id value from this.

To avoid confusion, we define a namespace and write XML like this:

<definitions xmlns:A = "Unique URI for Account" xmlns:C = "Unique URI for Contact"/>
<A:Account>
<A:Id>1-ABC</A:Id>
<C:Contact>
<C:Id>1-QWE</C:Id>
<C:Contact>
</A:Account>

Now I can clearly ask the system to get me the C:Id tag value. 

Note: xmlns stands for xml namespace. It is a standard to provide a unique resource identifier (URI) to identify a Namespace. If you do not specify a URI, then also Namespace works till the time the value is unique.

2 comments: