Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
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.
Location | Direction |
---|
Attribute | Description | ||
---|---|---|---|
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 |
which content types the endpoint |
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. | ||
Adapter | Request | Blob Body Content Type | Specify which content |
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 |
if a request uses a custom content type that does not match the content types listed in Blob Body Content Type. | ||
Response | Accepted Request Content Type | Specify a list of content types |
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 |
if a request uses a custom content type that does not match the content types listed in Accepted Request Content Type . |
Examples
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
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 Settings | Description | ||
---|---|---|---|---|
Store a blob | POST /blob | Accepted Request |
Content Type | application/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
Accepted Request Content Type
-
Reject Other Request Content Types
-
accept:
msword
The server can store Excel files. | ||||
Return a blob by id | GET /blob/<an id> | Blob Body Content Type | application/msexcel | The server returns Excel files upon request. |
Client (accessRestBlobContent.xml) | Content Type Settings | |||
---|---|---|---|---|
Send a blob | POST /blob |
Blob Body Content Type | application/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
Accepted Request Content Type |
-
Reject Other Request Content Types
-
accept:
msword
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
Accepted Request Content Type
msexcel
Reject Other Request Content Types
true
accept:
msword
POST Examples
application/msexcel | The client accepts Excel files as a response. |
Good Cases
The following table shows some example calls and how they would be executed.
Client | Generated Header | Server | |||
---|---|---|---|---|---|
1 | Store a blob | POST /blob | Content-Type: application/msexcel | → | accepts request |
← | returns id HTTP 201 | ||||
2 | Retrieve a blob | GET /blob/123456 | Accept: application/msexcel | → | accepts request |
Content-Type: application/msexcel | ← | returns 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.
Client | Custom Header | Server | |||
---|---|---|---|---|---|
1 | Store a blob, wrong content type | POST /blob | Content-Type: application/msword | → | accepts request |
handles wrong content type internally | |||||
2 | Store a blob, wrong content type, server rejects other content types | POST /blob | Content-Type: application/msword | → | Reject Other Request Content Types = true |
← | HTTP 406 (not acceptable) | ||||
3 | Retrieve a blob, wrong content type | GET /blob/123456 | Accept: application/msword | → | accepts request |
handles wrong content type internally | |||||
4 | Retrieve a blob, wrong content type, server rejects other content types | GET /blob/123456 | Accept: application/msword | → | Reject Other Response Content Type = true |
← | HTTP 415 (Unsupported Media Type) |
Accepted Request Content Type
- request performed
- response content type: msexcel
- REST service log:
RESTLM/10: Cannot generate any of the expected output formats
Reject Other Request Content Types
Blob Body Content Type
Reject Other Response Content Type
content-type:
Accepted Request Content Type
- request performed
- REST service returns HTTP 415
Reject Other Request Content Types
Blob Body Content Type
Reject Other Response Content Type
content-type:
Accepted Request Content Type
- request rejected by REST adapter
- Exception:
RESTLM/48: Request content type not declared as accepted by the service
Reject Other Request Content Types
Blob Body Content Type
Reject Other Response Content Type
content-type:
Otp | ||
---|---|---|
|
Rp |
---|