cancel
Showing results for 
Search instead for 
Did you mean: 

why a message type and not a data type ?

Shabarish_Nair
Active Contributor
0 Kudos

Hi friends,

I was wondering why we actually create a message type refering a data type .... cant the data type itself be used...

help says,

<b>For technical reasons, a data type is not sufficient to describe the instance of a message. In XML schema, data types are defined as abstract types that are not yet fixed to an element. You can only describe an instance of a message when you have specified a data type as an element type. Therefore, a message type defines the root element of a message.</b>

but i still couldnt understand what it really means .... could someone help me on this..

Regards,

ShabZ

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

We discussed about the technical aspects of it.Let me give a practical use of it. As some body pointed out it helps in re-usability. Assume that you have a data type- address with the following structure

<address>

<street></street>

<city></city>

<country></country>

</address>

In another case,if we have to give personal details of a person like name, age and <b>address</b> then we can reuse the address data type that we already have and need not create it again.So bundling of such data types in message types helps us in re-using the already available types leading to optimal utilization of resources.

Former Member
0 Kudos

Hi Shabarish,

According my understanding we use Message type just to define a Root Element of your XML file.

In Data type we define only data type used but not the root element. when we send ur message to XI server we send it XML form which requires ROOT element. Thats why we use Message Type. with the same datatype incroporated in the message Type.

Thanks

sreeram reddy.G

Former Member
0 Kudos

Hi Shabarish

The message itself is self-explanatory.

You cannot use a data-type because data types are abstract types. Check the xsd definition of your data-type and you will not find a <xsd:element name ...> tag in it. This tag is what defines the root element of the XML (otherwise your XML is not valid). This tag appears only when you create a message type. Have a look at the XSD definitions (in your IR) of both your data type and message type and you will have a better understanding.

cheers

Sameer

Shabarish_Nair
Active Contributor
0 Kudos

Hi Sameer,

Well reusability is a concept which i understand while using and MT but i still didnt get your statement

>>>>> Check the xsd definition of your data-type and you will not find a <xsd:element name ...> tag in it.

XSD for DT :

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://TEST" targetNamespace="http://TEST">

<xsd:complexType name="DT_TO_BW">

<xsd:annotation>

<xsd:appinfo source="http://sap.com/xi/TextID">

02b89bd0528211dab36f0003ba21f2a7

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<b><xsd:element name="DETAILS" type="xsd:string"></b> <xsd:annotation>

<xsd:appinfo source="http://sap.com/xi/TextID">

2ac16da0ee0f11d98738cb910ae04b59

</xsd:appinfo>

</xsd:annotation>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

XSD for MT :

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://TEST" targetNamespace="http://TEST">

<xsd:import namespace="http://TEST" />

<b><xsd:element</b> xmlns:p0="http://TEST" <b>name="MT_BW"</b> type="p0:DT_BW" />

</xsd:schema>

did you mean that only in MT it becomes the root ? Like - > <b><xsd:element</b> xmlns:p0="http://TEST" <b>name="MT_BW"</b> type="p0:DT_BW" />

Former Member
0 Kudos

yes

Former Member
0 Kudos

hi shabz...

when we say message..it generally is a collection of data...a data is nothing but just an detail which does not have any specified bound...

an message is something which is included in an interface which gives it the direction....(inbound / outbound)

and i believe in near future ther cud be scenarios wherrein u wud be able to include more than one data types in an message type...(sounds interesting..??)

so a combination of datas when send simultaneouly would be called as a message...

regards..

vishal