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

7. APIs, SDKs, and Services

7. APIs, SDKs, and Services

Invoking a Process Using JSON

Invoking a Process Using JSON

Invoking a process using JSON is similar to the method described for the XML binding endpoint:
  1. Prepare to send an HTTP POST message to the service JSON endpoint at
    http://host:port/active-bpel/services/JSON/serviceName
    .
  2. Set the POST header content-type to application/json.
  3. Set POST payload (body content) to be the string version of the JSON request.
  4. Include authorization headers if needed.
  5. Send an HTTP POST message to the service JSON endpoint.
The response from the POST is a HTTP 200/OK response with content-type of
application/json
. The response body will contain a JSON service response (as a string). The following snippet shows the HTTP request used to invoke the Loan Approval process using the
humantaskProcessDemoService
service. .
POST /active-bpel/services/JSON/humantaskProcessDemoService HTTP/1.1 Content-Length: 581 Content-Type: application/json; charset=UTF-8 Authorization: Basic YWVhZG1pbjphZWFkbWlu Host: localhost:8080 {"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 response to the above request looks like:
HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 {"status": {"xmlns":"http:\/\/www.active-endpoints.com\/wsdl\/humantaskdemo", "$t":"Thank you for applying for the Automobile loan for the amount of US$15000. Your loan is currently pending approval." } }