ONYX - 9.0 - Utilisation - mapSoapRunStreamFromPost/en

Différence entre versions

De MappingDoc
(Page créée avec « <code>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... »)
(Page créée avec « ===Introduction=== mapSoapRunStreamFromPost is a method of the "mapsoapserver.exe" Web service »)
 
(10 révisions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
<languages/>
 
<languages/>
 
===Introduction===
 
===Introduction===
mapSoapRunStreamFromPost est une méthode du WebService "mapsoapserver.exe"
+
mapSoapRunStreamFromPost is a method of the "mapsoapserver.exe" Web service
  
Cas d'usage :
+
When to use:
  
 
*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 file to Mapping and get a response file synchronously (e.g. sending an XML file and receiving a PDF in return).
Ligne 32 : Ligne 32 :
 
<code>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"</code>
 
<code>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"</code>
  
'''Avec un fichier XML'''
+
'''With an XML file'''
  
<code>curl -u mapadmin:mapadmin -X POST --data "@/tmp/mon_fichier.xml" "http://192.168.100.14:8002/cgi-bin/mapsoapserver.exe/mapSoapRunStreamFromPost?key=workflow&value=testsoap&key=typdoc&value=facture&key=enseigne&value=mag_paris&getobject=1"</code>
+
<code>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"</code>
  
  
<u>Remarques</u> :  
+
<u>Comments</u>:  
  
*Le paramètre "'''worfklow'''", permet de spécifier le nom du workflow à invoquer. S'il n'est pas renseigné, c'est le workflow "root" qui est appelé.
+
*"'''worfklow'''" is the name of the workflow you want to call. If blank, the "root" workflow is called.
*"macle1", "mapcle2", "typdoc" et "enseigne" sont des exemples de méta données récupérables dans le workflow, permettant à Mapping d'effectuer le traitement adapté au fichier.
+
*"mykey1", "mykey2", "typdoc" and "store" are sample metadata retrieved from the workflow that Mapping will use to process the file.
*La présence du @ dans l'option --data-binary permet de spécifier qu'il s'agit d'un fichier.
+
*The @ sign in option --data-binary means it's a file.
*Dans le premier exemple, le fichier transmis étant un PDF, l'option utilisée est --data-binary , mais pour les fichiers "texte", comme l'exemple XML, l'option pourrait être "--data"
+
*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"
* Dans le 2ème exemple, le paramètre "getobject=1" permet d'avoir une réponse de type "octet-stream", sans enveloppe XML ni encodage en base64
+
* In the 2nd example, the "getobject=1" parameter means it's a "bit-stream" response, without XML envelope nor base64 encoding
  
===Exemple de workflow pour traitement asynchrone===
+
===Sample asynchronous workflow===
  
*La variable param1 récupère le contenu de macle1 (boite paramètre)
+
*Param1 retrieves the content of mykey1 (parameter box)
*La variable param2 récupère le contenu de macle2 (boite paramètre)
+
*Param2 retrieves the content of mykey2 (parameter box)
*La boite "Print" permet d'envoyer le fichier dans la file d'attente "MON_ENTRY" (boite "Imprimer")
+
*The "Print" box sends the file to the queue "MY_ENTRY"
**Le fichier transmis dans le flux du WebService est [%MAP_FILE_IN%]
+
**The file transferred in the Web service data stream is [%MAP_FILE_IN%]
**La coche "Ajouter les paramètres courants" permettent de transmettre les variables param1 et param2 avec le fichier dans la file d'attente "MON_ENTRY"
+
**The checkmark "Add current parameters" transfers the variables param1 and param2 with the file to the "MY_ENTRY" queue
  
 
<br />
 
<br />
Ligne 59 : Ligne 59 :
 
              
 
              
  
===Exemple de workflow pour traitement synchrone===
+
===Sample synchronous workflow===
  
*La variable param1 récupère le contenu de macle1 (boite paramètre)
+
*Param1 retrieves the content of mykey1 (Parameter box)
*La variable param2 récupère le contenu de macle2 (boite paramètre)
+
*Param2 retrieves the content of mykey2 (Parameter box)
*Composition du document XML en XPS (boite Designer)
+
*XML document composition to XPS (Designer box)
*Conversion du XPS en PDF (Boite de conversion vers PDF)
+
*Convert XPS to PDF (toPDF box)
*Envoi du résultat dans la réponse de la requête SOAP (Boite "Affichage dans le navigateur")
+
*Send result to SOAP request response ("Show in browser" box)
  
  
{{warning}} 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".
+
{{warning}} The box that sends the result to the consumer must be in the workflow triggered by the Web service. It should NOT be placed in a sub-workflow called by a "call".
  
 
[[Fichier:OX S mapsoaprunstreamfrompost.png|centré|350x350px|alt=|sans_cadre]]
 
[[Fichier:OX S mapsoaprunstreamfrompost.png|centré|350x350px|alt=|sans_cadre]]

Version actuelle datée du 29 octobre 2019 à 10:48

Autres langues :
English • ‎français

Introduction

mapSoapRunStreamFromPost is a method of the "mapsoapserver.exe" Web service

When to use:

  • 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)


Warning-300px.png The box that sends the result to the consumer must be in the workflow triggered by the Web service. It should NOT be placed in a sub-workflow called by a "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