ONYX - 9.0 - Usage
mapSoapRunStreamFromPost
Sommaire
Introduction
mapSoapRunStreamFromPost est une méthode du WebService "mapsoapserver.exe"
Cas d'usage :
- Send a file to Mapping and get a response file synchronously (e.g. sending an XML file and receiving a PDF in return).
- Send a large file to Mapping asynchronously. All file types are supported.
Usage
- POST method
- Parameters:
- - Workflow: name of the Mapping workflow that will be called
- - key/value combination: metadata
- - File sent
- - Response type (XML with base64 encoded file, or direct file)
- Examples: XML, PDF, XPS, TXT, CSV, EXE, JPG, PNG, ZIP etc.
- Contrary to the mapUploadFile method, mapSoapRunStreamFromPost lets you call a workflow
- The content of the file should be passed in the body, without envelope and without base64 encoding
- All <key/value> parameters should be passed in the URL exclusively (no XML envelope)
- In the workflow:
- The key/value combinations are used in the workflow as [%xxxx%] variables
- The file is identified using the [%MAP_FILE_IN%] variable
- If the "getobject=1" parameter is added to the URL, the body of the response contains the file from the workflow without XML envelope nor base64 encoding.
Sample SOAP request
With a PDF file
curl -u mapadmin:mapadmin -X POST --data-binary "@/tmp/my_file.pdf" "http://192.168.100.14:8002/cgi-bin/mapsoapserver.exe/mapSoapRunStreamFromPost?key=workflow&value=testsoap&key=mykey1&value=myvalue1&key=mykey2&value=myvalue2"
With an XML file
curl -u mapadmin:mapadmin -X POST --data "@/tmp/my_file.xml" "http://192.168.100.14:8002/cgi-bin/mapsoapserver.exe/mapSoapRunStreamFromPost?key=workflow&value=testsoap&key=typdoc&value=invoice&key=store&value=store_paris&getobject=1"
Comments:
- "worfklow" is the name of the workflow you want to call. If blank, the "root" workflow is called.
- "mykey1", "mykey2", "typdoc" and "store" are sample metadata retrieved from the workflow that Mapping will use to process the file.
- The @ sign in option --data-binary means it's a file.
- In the first example as the file is a PDF the option used is --data-binary, but for "text" file as in the XML example, the option could be "--data"
- In the 2nd example, the "getobject=1" parameter means it's a "bit-stream" response, without XML envelope nor base64 encoding
Sample asynchronous workflow
- Param1 retrieves the content of mykey1 (parameter box)
- Param2 retrieves the content of mykey2 (parameter box)
- The "Print" box sends the file to the queue "MY_ENTRY"
- The file transferred in the Web service data stream is [%MAP_FILE_IN%]
- The checkmark "Add current parameters" transfers the variables param1 and param2 with the file to the "MY_ENTRY" queue
Sample synchronous workflow
- Param1 retrieves the content of mykey1 (Parameter box)
- Param2 retrieves the content of mykey2 (Parameter box)
- XML document composition to XPS (Designer box)
- Convert XPS to PDF (toPDF box)
- Send result to SOAP request response ("Show in browser" box)
La boite permettant de renvoyer le résultat au consommateur doit se trouver dans le Workflow déclenché par le WebService. Elle ne peut en aucun cas se trouver dans un sous workflow invoqué par un "call".
Open Api Specification 3 (YAML)
openapi: "3.0.0"
info:
title: mapSoapRunStreamFromPost
description: Send a file to Mapping
version: "0.0.0"
servers:
- url: "{protocol}://{server}:{port}/mapsoapserver.exe"
description: Local Server
variables:
protocol:
default: 'http'
server:
default: '127.0.0.1'
port:
default: '8002'
paths:
/mapSoapRunStreamFromPost:
post:
summary: Send a file to a Mapping Workflow
tags:
- mapSoapRunStreamFromPost
parameters:
- name: workflow
in: query
required: false
description: Name of the workflow to call
schema:
type: string
example: my_workflow
- name: key
in: query
required: false
description: key
explode: true
style: form
schema:
type: array
items:
type: string
example: my_key
- name: value
in: query
required: false
description: value
explode: true
style: form
schema:
type: array
items:
type: string
example: my_value
requestBody:
required: true
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: Base64 response sent by the Workflow
content:
application/xml:
schema:
type: object
xml:
name: 'Envelope'
prefix: 'soap'
namespace: "http://schemas.xmlsoap.org/soap/envelope/"
properties:
Body:
type: object
xml:
prefix: soap
properties:
mapSoapRunStreamFromPostResponse:
type: object
properties:
mapSoapRunStreamFromPostResult:
type: object
properties:
document:
type: string
format: byte
description: base64 content