Tutorials

  1. Home
  2. Dokumente
  3. Tutorials
  4. 49. What is the rest template message type?

49. What is the rest template message type?

Learning Objective:

After completing this unit, you’ll be able to:

  • Describe Rest Message Structure
  • Easily create rest template message type

 

Rest Template is used to create applications that consume REST Web Services. To   secure our data transmission system need specific formatted data.

What is the rest template message type?

We use a message type which we create according to the response structure of the REST response then the message name should be the root node. The processing should be based on the message node. To secure our data transmission system need specific formatted data. We have create message type.  The messaging contain message data and metadata i.e. information about message itself. In Skyvva we have specific soap template message type contains URL, body.

we need both part e.g. Request and Response. When we design the callout interface using our different template we put Request into the outbound and Response into the inbound interface. We are using template mainly for the outbound call.

In Skyvva we have specific Rest template message type contains URL, header and body. We have different template for request and response. . As we have three element in Request: ,

  1. Request URL
  2. Request Header
  3. Request Body

Request Structure:

{ 
"Google REST Service":{ 
"Request":{ 
"URL":{ 
"PATH Param":{ 
//Flate Strture..
},
"Query Param":{ 
//Flate Strture..
}
},
"Header":{ 
//Flate Strture..
},
"Body":{ 
//Custom Buisness Messagetype
}
}
}
}

What is Rest response?

When an JSON String is sent to a REST service, you must set Content-Type HTTP header to be “application/JSON”. The REST service converts the XML input data to the JSON format that is accepted by REST services.

Only contain business Message type.

Response Structure:

{
root   
//Custom Buisness Message Type like Account,Contact,Asset,Opportunity,Case
}

So , when we get response and we will get both header and body so based on mapping we will perform DML operation for the data we got in response.

Template should Looks like:

Example:

Template should Looks like:

Example:

{
“Complex_JSON_REST_Service”: {
“Request”: {
“URL”: {
“Path Parameter”: {},
“QUERY Parameter”: {}
},
“Header”: {},
“Body”: {
“Account.Owner”: [
{
“Account Number”: “Acoount-1”,
“Phone”: 123456789,
“Shipping Address”: {
“Shipping City”: “Surat”,
“Shipping Street”: “292, Gayatri Society”,
“Description Information”: {
“Description”: “Testing Account1 Description.”
}
},
“Billing Address”: {
“Billing City”: “Surat”,
“Billing Country”: “India”,
“Billing Street”: “292, Gayatri Society”
},
“My.Contact”: [
{
“FirstName”: “Testing”,
“LastName”: “Contact1”,
“Other Address”: {
“Other City”: “Surat”,
“Other Country”: “India”,
“Other Street”: “292, Gayatri Society”
},
“Mailing Address”: {
“Mailing City”: “Surat”,
“Mailing Street”: “292, Gayatri Society”,
“Description Information”: {
“Description”: “Testing Contact1 Description.”
}
},
“MyAsset”: [
{
“AssetName”: “Testing Asset1”,
“Quantity”: 15,
“SerialNumber”: “Asset-1”
}
] }
] }
] }
},
“Response”: {
“root”: {
“MyAccount”: [
{
“Description”: “Testing Account1 Description.”,
“Name”: “Testing Account1”,
“MyContact”: [
{
“FirstName”: “Testing”,
“LastName”: “Contact1”,
“MyAsset”: {
“AssetName”: “Testing Asset1”,
“Quantity”: “15.00”,
“SerialNumber”: “Asset-1”
}
},
{
“FirstName”: “Testing”,
“LastName”: “Contact2”,
“MyAsset”: {
“AssetName”: “Testing Asset2”,
“Quantity”: “15.00”,
“SerialNumber”: “Asset-2”
}
}
] },
{
“Description”: “Testing Account2 Description.”,
“Name”: “Testing Account2”,
“MyContact”: [
{
“FirstName”: “Testing”,
“LastName”: “Contact3”,
“MyAsset”: {
“AssetName”: “Testing Asset3”,
“Quantity”: “15.00”,
“SerialNumber”: “Asset-3”
}
},
{
“FirstName”: “Testing”,
“LastName”: “Contact4”,
“MyAsset”: {
“AssetName”: “Testing Asset4”,
“Quantity”: “15.00”,
“SerialNumber”: “Asset-4”
}
}
] }
] }
}
}
}

In message type table, your template should looks like as below;

Message Type Template format:


Rest Adapter Template
"Rest Service":{
"Request":{
"URL":{
"PATH Parameter":{
//flat Structure
},
"QUERY Parameter":{
//flat Structure
}
},
"Header":{
//flat Structure
},
"Body":{
//flat Structure
//Custom Hierarchical Business Message type
}
}
}
}

 

Terms should know:

Request URL:

A Request URL specifies the Method Token (GET, PUT … ) followed by the RequestURI and then the HTTP Protocol that is being used. There are two URL parameter:

  1. Path parameter:
  2. Query parameter:

Request Header:

The REST headers and parameters contain a wealth of information that can help you track down issues when you encounter them.

Request Body: The request body is used to send and receive data.

Response Status: It provides information about the status codes and error messages that can be received.

Response Header: The response may contain URI in Location header field in HTTP headers list, which can have reference to the newly created resource

How to create Message Type?

There are different ways to create message type from IStructureRepository:

  1. Upload File
  2. Open Editor
  3. Manually create New Message Type.

Upload File:

Skyvva support different file formats(xsd, json schema, wsdl 1.1 & 2.0, swagger 2.0 and openAPI 3.x) to create message type.  Upload button  automatically create a hierarchical structure like msgtype Istructure  from hierarchical file.

Pre-requisite:

To create Metadata Provider.

To Create  Istructure Repository.

Go to Istructure Repository and click on “Upload File” button.

 

Select file format which you want to upload.

Open Editor

To create Metadata Provider.

To Create  Istructure Repository.

Go to Istructure Repository and click on “Open Editor” button.

 

Manually Create message type:

  1. To create Metadata Provider.
  2. To Create  Istructure Repository.
  3. Go to Istructure Repository and click on “New message Type” button.

It will navigate to:

Once we Save this Message type is created.

 

Fandest du diesen Artikel hilfreich? Ja Nein

Wie können wir helfen?