Skip to content

http response

Nathan Richardson edited this page Jan 17, 2019 · 6 revisions
Http Response

Icon

metl web 48x48 color

Use When

A RESTful service needs to be created and hosted by the Metl server

Samples

Service Get All Persons, Service Get All Persons Custom XML, Service Get Person By Id, Service Upsert Persons

Description

The HTTP Response component is used to define the expected outbound HTTP Response for a RESTful service that will be hosted by the Metl server

Inbound Message Type

Text Based Message

Output Message Type

None

Control Message Handling

Input: Messages are processed as they are received.

Output: No output messages are generated from this component.

Properties
Name Description

Error Suspense Step

Whether to forward failed messages and continue processing. This is the name of a linked component to forward the failed messages to.

Enabled

Returns Data

Whether the component returns the input text message as part of the response.

Content Type

The content type of the output. If an input model is specified, and the http response component is automatically marshalling the output, the content type will be set automatically based on the accept parameter of the request. If no input model is specified and the flow is formatting the outbound message as part of the flow, the content type should be set as appropriate.

Log Input

Log Output

Inbound Queue Capacity

Example 1. Automatic marshelling of xml or json in the http response component

As discussed above, if the Inbound Model is specified, the http response component will attempt to automatically marshal the payload of the inbound entity message into either an xml or json outbound payload. The format of the xml or json will look as follows:

XML Example

<ArrayList>
	<item>
		<name>PERSON</name>   <!-- The model entity -->
		<data>
			<GENDER>M</GENDER>  <!== The model attributes -->
			<ID>1</ID>
			<LAST_NAME>Arbuckle</LAST_NAME>
			<FIRST_NAME>Garfield</FIRST_NAME>
		</data>
	</item>
	<item>
		<name>PERSON</name>	<!-- The second row of entity and attributes -->
		<data>
			<GENDER>M</GENDER>
			<ID>2</ID>
			<LAST_NAME>Arbuckle</LAST_NAME>
			<FIRST_NAME>Odie</FIRST_NAME>
		</data>
	</item>
</ArrayList>

JSON Example

[
	{
		"name":"PERSON",
		"data":
		{
			"GENDER":"M",
			"ID":"1",
			"LAST_NAME":"Arbuckle",
			"FIRST_NAME":"Garfield"
		}
	},
	{
		"name":"PERSON",
		"data":
		{
			"GENDER":"M",
			"ID":"2",
			"LAST_NAME":"Arbuckle",
			"FIRST_NAME":"Odie"
		}
	}
]

If an input model is NOT specified, the flow will need to format the output in either xml or json format accordingly.

Clone this wiki locally