Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 23.1a

Runtime 2021.6 Builder 7.15.0 The xUML Runtime can handle blob parameters in the body of a REST interface. This can be configured by four tags on REST operations for REST service and REST adapter.

Find below an overview on these tags and what combinations make sense.

LocationDirection
Tag
AttributeDescription
Service
Request

Accepted Request Content Type

Define which content types the endpoint accepts.

Reject Other Request Content Types

Define if other content types should be rejected with HTTP 406 (Not Acceptable).
Response

Blob Body Content Type

Define
a list of
which content types the endpoint
returns
can return to the client.

Reject Other Response Content Type

Define if the service should reject the request with HTTP 415 (Unsupported Media Type) if the client request has divergent accept headers.
AdapterRequest

Blob Body Content Type

Specify which content
types the endpoint requires
type you are sending with your request. The Runtime generates a matching "Content-Type" header to your request.

Reject Other Response Content Type

Specifies if the REST adapter should reject calls to this endpoint

using

if a request uses a custom content type that does not match the content types listed in Blob Body Content Type.
This can be the case if you set the content-type header manually. If set to true, and the content-type header does not match, the adapter does not contact the endpoint at all but rejects calls with an exception (Request content type not declared as accepted by the service).

Response

Accepted Request Content Type

Specify a list of content types
the endpoint returns
you accept as a response. The Runtime generates a matching "Accept" header to your request.

Reject Other Request Content Types

Specifies if the REST adapter should reject calls to this endpoint

using

if a request uses a custom content type that does not match the content types listed in Accepted Request Content Type .
This can be the case if you set the accept header manually. If set to true, and the accept header does not match, the adapter does not contact the endpoint at all but rejects calls with an exception (Set "accept" header does not accept any of declared response content types).

Examples

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNamerest_adapter_blob
PageWithExcerptINTERNAL:_examples_BRIDGE

The example service provides a REST interface to store a blob to memory and retrieve stored blobs. The service accepts content type application/msexcel.

GET Examples

Server (restBlobContent.xml)Content Type SettingsDescription
Store a blobPOST /blobAccepted Request
NrLocationTagRemark1ServiceBlob Body 2Service
Content Typeapplication/msexcel
  • request performed
  • response content type: msexcel
  • REST service log: RESTLM/47: Client does not accept any of declared response content types

Reject Other Response Content Type

false

Adapter

Accepted Request Content Type

-

Reject Other Request Content Types

-

Header

accept:

msword

The server can store Excel files.
Return a blob by idGET /blob/<an id>Blob Body Content Typeapplication/msexcelThe server returns Excel files upon request.
Client (accessRestBlobContent.xml)Content Type Settings
Send a blob
POST /blob
Blob Body Content Typeapplication/msexcel
  • request performed
  • REST service returns HTTP 406
The client sends Excel files.
Retrieve a blob
GET /blob/<an id>

Reject Other Response Content Type

true

Adapter
Accepted Request Content Type

-

Reject Other Request Content Types

-

Header

accept:

msword

3Service

Blob Body Content Type

application/msexcel

  • request rejected by REST adapter
  • Exception: Set "accept" header does not accept any of declared response content types

Reject Other Response Content Type

Adapter

Accepted Request Content Type

msexcel

Reject Other Request Content Types

true

Header

accept:

msword

POST Examples

application/msexcelThe client accepts Excel files as a response.

Good Cases

The following table shows some example calls and how they would be executed.

ClientGenerated HeaderServer
1Store a blob

POST /blobContent-Type: application/msexcelaccepts request


returns id
HTTP 201
2Retrieve a blob
GET /blob/123456Accept: application/msexcelaccepts request

Content-Type: application/msexcelreturns Excel file

Error Cases

The following table shows some error cases and their consequences if you do not rely on the automatically generated headers but set your own headers instead.

ClientCustom HeaderServer
1Store a blob, wrong content typePOST /blobContent-Type: application/mswordaccepts request



handles wrong content type internally
2Store a blob, wrong content type,
server rejects other content types


POST /blobContent-Type: application/msword

Reject Other Request Content Types = true



HTTP 406 (not acceptable)
3Retrieve a blob, wrong content type
GET /blob/123456Accept: application/mswordaccepts request



handles wrong content type internally
4Retrieve a blob, wrong content type,
server rejects other content types


GET /blob/123456Accept: application/mswordReject Other Response Content Type = true


HTTP 415 (Unsupported Media Type)
NrLocationTagRemark1Service

Accepted Request Content Type

application/msexcel
  • request performed
  • response content type: msexcel
  • REST service log: RESTLM/10: Cannot generate any of the expected output formats

Reject Other Request Content Types

-Adapter

Blob Body Content Type

-

Reject Other Response Content Type

-Header

content-type:

msword 2Service

Accepted Request Content Type

application/msexcel
  • request performed
  • REST service returns HTTP 415

Reject Other Request Content Types

true Adapter

Blob Body Content Type

-

Reject Other Response Content Type

-Header

content-type:

msword 3Service

Accepted Request Content Type

application/msexcel
  • request rejected by REST adapter
  • Exception: RESTLM/48: Request content type not declared as accepted by the service

Reject Other Request Content Types

Adapter

Blob Body Content Type

application/msexcel

Reject Other Response Content Type

true Header

content-type:

msword