The third-party application CURL (http://curl.haxx.se/) is a command line utility that you can use to test the POST request. CURL provides a very useful trace option that generates and lists the part boundaries of requests, which you can use directly in your requests or as a reference.
Given below is a sample test scenario in which an XML file is validated against an XML Schema. We assume the following:
•the commands below are executed from the folder in which the files to be submitted for validation are located; (this enables us to write simple relative paths to these files). If you have installed Altova's XMLSpy application, the files used in this example can be found in the application's Examples folder, which is located by default at: C:\Users\<username>\Documents\Altova\XMLSpy2022\Examples
•RaptorXML+XBRL Server is running locally on port 8087
For more information about the CURL command line options, see the CURL Help.
[input: powershell]
\path\to\curl.exe -F 'msg={\"command\": \"xsi\", \"args\":[\"additional-files:///PurchaseOrder.zip%7Czip/ipo.xml\"], \"options\":{}};type=application/json' -F "additional-files=@PurchaseOrder.zip;type=application/octet-stream" http://localhost:8087/v1/queue
Note: | In powershell, if quotes occur within quotes, different types of quotes (single/double) must be used. |
[input: cmd]
\path\to\curl.exe -F "msg={\"command\": \"xsi\", \"args\":[\"additional-files:///PurchaseOrder.zip%7Czip/ipo.xml\"], \"options\":{}};type=application/json" -F "additional-files=@PurchaseOrder.zip;type=application/octet-stream" http://localhost:8087/v1/queue
[output]
{"jobid": "058F9E97-CB95-43EF-AC0A-496CD3AC43A3", "result": "/v1/results/058F9E97-CB95-43EF-AC0A-496CD3AC43A3"}
[input]
\path\to\curl.exe http://localhost:8087/v1/results/058F9E97-CB95-43EF-AC0A-496CD3AC43A3
[output]
{"jobid":"058F9E97-CB95-43EF-AC0A-496CD3AC43A3","state":"OK","error":{},"jobs":[{"file":"additional-files:///PurchaseOrder.zip%7Czip/ipo.xml","jobid":"D4B91CB0-CF03-4D29-B563-B6506E123A06","output":{},"state":"OK","error":{}}]}
CURL has a trace option (--trace-ascii), which traces the HTTP traffic sent to and from the server. The option is very useful since it lists the part boundaries that are required for initiating jobs with POST. You can use the information in the trace, either directly or as a reference, to create the part boundaries. The listing below shows the trace obtained by running the command given above.
Note: | Notice from the above listing that 'Content-Disposition: form-data' is also valid, in addition to 'Content-Disposition: attachment'. |
/path/to/curl -F 'msg={"command": "wfxml", "args":[]};type=application/json' -F "args=@ipo.xml;type=application/octet-stream" http://localhost:8087/v1/queue
/path/to/curl -F 'msg={"command": "wfxml", "args":["additional-files:///ipo.zip%7Czip/ipo.xml"]};type=application/json' -F "additional-files=@ipo.zip;type=application/octet-stream" http://localhost:8087/v1/queue