Integration Server (handling file upload requests for OpenAPI 3.0)

Introduction

OpenAPI 3.0 provides a way to define file uploads using type as string and format as either binary or base64, with base64 the file content is actually encoded using base64 before sending to the provider.

When webMethods Integration Server receives such file upload with base64 format, the file content will get decoded before actually reaching to the service.

File upload with binary format

requestBody:
  content:
    image/jpg:
      schema:
        type: string
        format: binary

File upload with base64 format

requestBody:
  content:
    text/html:
      schema:
        type: string
        format: base64		

For file upload, the services generated by webMethods Integration Server will have an input of type byte.

Note: For base64 format, we need to encode the file content with base64 before passing them through the request.

File upload OpenAPI 3.0 (Provider)
fileUploadProvider

File upload OpenAPI 3.0 (Consumer)
fileUploadConsumer

** Beware of handling large files in this manner. Can exhaust memory because the entire content is loaded into memory.

2 Likes

Hi Malik,

I have tried your provider solution, but in the generated document i have the line : >>>contentStream=com.wm.net.HttpInputStream@20754e7c<<<
instead of the original doc. It’s like the IntegrationServer managed the request body as a contentStream and not with the requestBody document definition using titled_1 as document content.

Do you have used a specific content handler or a specific setting of the IS.

Best regards.
Christophe.

Hi Christophe,

May I know in which version you are trying? for file upload and multipart there are some enhancements in version 10.11 and same is planned for back port to version 10.7, there might be some existing bugs which restricts this, let me have a quick look into 10.7 and will get back to you.

Yes if there are no content handler we will have similar to what you received, but in case of openAPI this behavior is changed and the output should be exactly same as the service signature generated while importing the openAPI document.

I am planning to attach a sample package into this page.

Thanks

Hi Malik,

Tanks for your answer.
At this moment we are using the 10.7 version.
In the documentation, i didn’t find any place where to manage content handler in case of OpenApi.
Best regards.

Christophe