Table of Contents

Search

  1. Preface
  2. Overview, Downloading, and Installing
  3. Administration API
  4. Identity Service API
  5. Screenflow Programming and SDK
  6. ActiveVOS WSHT API
  7. Embedding Request Forms in Standalone Web Pages
  8. XML-JSON for Process Central

APIs, SDKs, and Services

APIs, SDKs, and Services

Attachments Using Multipart Form-Data

Attachments Using Multipart Form-Data

Processes can be invoked using a
multipart/form-data
type payload (normally used by HTML forms). When using this content-type, Process Server requires the form-data to contain one field with name
_json
. The value of this field must contain the JSON request.
POST /active-bpel/services/JSON/humantaskProcessDemoService HTTP/1.1 Content-Type: multipart/form-data; boundary="the_boundary" Content-Length: 3449 MIME-Version: 1.0 Host: localhost:8080 --the_boundary Content-Disposition: form-data; name="_json" {"loanProcessRequest":{"xmlns":"http:\/\/schemas.active-endpoints.com\/sample\/LoanRequest\/2008\/02\/loanRequest.xsd","loanType":{"$t":"Automobile"},"firstName":{"$t":"John"},"lastName":{"$t":"Smith"},"dayPhone":{"$t":"2039299400"},"nightPhone":{"$t":"2035551212"},"socialSecurityNumber":{"$t":"123-45-6789"},"amountRequested":{"$t":"15000"},"loanDescription":{"$t":"Application to finance the purchase of a Toyota Prius"},"otherInfo":{"$t":"Down payment is US$7500"},"responseEmail":{"$t":"john.smith@example.com"}}} --the_boundary Content-Disposition: form-data; name="file_1"; filename="picture.gif" Content-Type: image/gif [image content] --the_boundary--
The above request was generated by the HTML form:
<form method='POST' enctype='multipart/form-data' action='http://localhost:8080/active-bpel/services/JSON/humantaskProcessDemoService'> <!-- JSON message payload in a hidden field named '_json' --> <input type="hidden" name="_json" value='{"loanProcessRequest":{"xmlns":"http:\/\/schemas.active-endpoints.com\/sample\/LoanRequest\/2008\/02\/loanRequest.xsd","loanType":{"$t":"Automobile"},"firstName":{"$t":"FileUploadJohn"},"lastName":{"$t":"Smith"},"dayPhone":{"$t":"2039299400"},"nightPhone":{"$t":"2035551212"},"socialSecurityNumber":{"$t":"123-45-6789"},"amountRequested":{"$t":"15000"},"loanDescription":{"$t":"Application to finance the purchase of a Toyota Prius"},"otherInfo":{"$t":"Down payment is US$7500"},"responseEmail":{"$t":"john.smith@example.com"}}}' /> File1: <input type="file" name="file_1" /> <br/> <input type="submit" value="Upload File"/> </form>
Normally the
multipart/form-data
request generation and handling of the response is done using JavaScript (for AJAX-style browser applications). Note that the response to a process invoke (with or without attachments) using
multipart/form-data
, is an
application/json
response (as shown in previous examples--use the table of contents to see them). Since a response from a process can have attachments in addition to the response message (JSON), you can limit the response to the message (JSON) only by specifying
messageOnly=true
in the query string. Similarly, to restrict the response to contain only the attachments (if the process sends back attachments), use
attachmentOnly=true
in the query string.

0 COMMENTS

We’d like to hear from you!