-
Notifications
You must be signed in to change notification settings - Fork 83
http response
Icon |
|
---|---|
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 |
None |
Output Message Type |
Any |
Name | Description |
---|---|
Input Model |
If an input model is specified, Metl will attempt to automatically marshal the payload of the entity based inbound message to the http response component into a json or xml outbound message See Example 1 below. |
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 approproiate. |
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.