HTTP messages and content types

To work with REST messages and content in Semarchy xDI Designer, you must add entries for all expected content to your HTTP REST metadata.

Configure your metadata

From the Project Explorer, open an HTTP REST metadata object. Add an HTTP method if you don’t have one already.

Depending on where in your flow you plan to work with the content, continue to the HTTP requests and HTTP responses section.

For HTTP requests

To send a message with an HTTP request, you must add it to a request body.

In the metadata editor, find an operation node to which you want to add content. If a Request Body node does not exist already, open the context menu on the operation node, and select New > Request Body to create it.

Open the context menu on the Request Body node, and select New > Content. A content node appears.

Select the new content node to open its properties. Set the Media Type and the Content-Type header according to the needs of your server.

howto content request
To create multipart requests, see Multipart data.

For HTTP responses

To receive a message in an HTTP response, you must add it to a response with the appropriate response code.

In the metadata editor, find an operation node where you want to add content. If a Responses node does not exist already, open the context menu on the operation node, and select New > Responses to create it.

Open the context menu on the Responses node, and select New > Response. A response node appears. Set its Code to the HTTP response code you plan to work with, or to default to catch any unspecified codes. Define as many responses as you want.

For each response you plan to work with, open the context menu on the Request Body node, and select New > Content. A content node appears.

Select the new content node to open its properties. Set the Media Type and the Content-Type header according to the needs of your server.

howto content response

Nested elements

You can also add and nest form, JSON, or XML elements and structures to a content node. Adding these elements allows you to work with them as a direct part of the REST operation within your integration flow.

Make sure to set the content node’s media type to the elements you add.

howto content json

Content types

Media type

Semarchy xDI handles five media types for HTTP messages:

  • BINARY

  • FORM

  • JSON

  • TEXT

  • XML

Select the appropriate type based on your content.

Content-Type header

You can also choose the Content-Type header that xDI sends to the web server. The following headers are available by default:

  • application/json

  • application/octet-stream

  • application/xml

  • application/x-www-form-urlencoded

  • text/csv

  • text/plain

To use a different header, type it manually in the field.

Configure your mapping

Create or open a mapping.

Add HTTP REST metadata to your mapping, and unfold the HTTP method until you see content nodes and nested elements.

Map your datastores to and from the content fields, and their nested elements if applicable.

howto content json mapping