Runtime 2021.6Builder 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
Tag
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 a list of content types the endpoint returns 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 types the endpoint requires.
Reject Other Response Content Type
Specifies if the REST adapter should reject calls to this endpoint using a content type that does not match the content types listed in Blob Body Content Type. If set to true, 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.
Reject Other Request Content Types
Specifies if the REST adapter should reject calls to this endpoint using a content type that does not match the content types listed in Accepted Request Content Type. If set to true, 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
Example File (Builder project Add-ons/REST):
<your example path>\Add-ons\REST\uml\restBlobContent.xml <your example path>\Add-ons\REST\uml\accessRestBlobContent.xml
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
Nr
Location
Tag
Remark
1
Service
Blob Body 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
Adapter
Accepted Request Content Type
-
Reject Other Request Content Types
-
Header
accept:
msword
2
Service
Blob Body Content Type
application/msexcel
request performed
REST service returns HTTP 406
Reject Other Response Content Type
true
Adapter
Accepted Request Content Type
-
Reject Other Request Content Types
-
Header
accept:
msword
3
Service
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
Nr
Location
Tag
Remark
1
Service
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
2
Service
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
3
Service
Accepted Request Content Type
application/msexcel
request rejected by REST adapter
Exception: RESTLM/48: Request content type not declared as accepted by the service