|
Genesys 8.0 SCXML Technical Reference |
||
| External 2.0 Interfaces > | |||
The following sections cover how the orchestration platform interfaces with an application server.
The following sections cover the mapping of the SCXML and functional module element's attributes into the corresponding HTTP message elements.
<fetch> mappingHere is an example of the <fetch> action:
<session:fetch requestid="_data.reqid" srcexpr="'http://www.business1.com/data2/content'" type="'plain-text'" method="'get or delete'" timeout="'100'" maxstale="'10'" maxage="'20'"> <param name="'param1'" expr="'value1'"/> <parm name="'p2'" expr="'v2'"/> </session:fetch>
Here is how it maps to an HTTP GET/DELETE message:
GET/DELETE /data2/content? param1=value1&p2=v2 HTTP/1.1 Host: www.business1.com Cache-Control: max-age=10, max-stale=10 ...
Mapping Summary:
srcexpr attribute yields the host and path elements of the HTTP message.<param> elements yields the URL parameter list at the end of the path. Note that if the srcexpr attribute evaluates to a URL with URL parameters, we would concatenate the <param> element parameters to them. If the <param> element value is a complex object, the value is the result of evaluating the toString() function of that object, which is usually [object object].maxage attribute yields the Cache-Control header with the max-age directive.maxstale attribute yields the Cache-Control header with the max-stale directive.type attribute yields the Accept header. Also the data type returned by the application server in the HTTP response will be checked against the type value. If it is different, an error.session.fetch will be raised — an exception that is text-plain, which means any type of returned value is accepted.<data> mappingHere is an example of the <data> action:
<state id="bdataY" src="http://www.business1.com/parameters/dataY" />
Here is how it maps to an HTTP GET message:
GET /parameters/dataY HTTP/1.1 Host: www.business1.com Cache-Control: max-age=10, max-stale=10 ...
Mapping Summary:
src attribute yields the host and path elements of the HTTP message.max-age directive is set using the value configured by the orchestration platform.max-stale directive is set using the value configured by the orchestration platform.<response> mappingHere is an example of a positive <response> action:
<ws:response requestid="_event.sendid"> <param name="'param1'" expr="'value1'"/> <parm name="'p2'" expr="'v2'"/> <parm name="'p3" expr="'v3'"/> </ws:response>
Here is how it maps to an HTTP GET Response message:
HTTP/1.1 200
Content-Type=application/json
Content-Length=xx
{"param1":"value1","p2":"v2","p3":{"a":4,"b":5}}
...
Here is an example of a negative <response> action:
<ws:response requestid="_event.sendid" type="negative" resultcode="invalidparameter"> <param name="'description" expr="'Invalid value for parm2"/> </ws:response>
Here is how it maps to an HTTP GET Response message:
HTTP/1.1 500 invalidparameter
Content-Type=application/json
Content-Length=xx
{"description":"Invalid value for parm2"}
...
Mapping Summary:
<param> elements yields the body element formatted in JSON format, where each <parameter> name should appear as a top-level attribute. Note: the Content-Length header value will be set to the total length of the resulting body element. Content-Type header value will always be "application/json".Status-Code header value will either be "200" for positive responses or "500" for negative responses. resultcode attribute will be mapped to the Reason-Phrase header element.<fetch> mappingHere is an example of the <fetch> action with enctype = application/x-www-form-urlcoded:
<session:fetch requestid="_data.reqid" srcexpr="'http://www.business1.com/data2/content'" type="'plain-text'" method="'post or put'" timeout="'100'" maxstale="'10'" maxage="'20'" enctype="'x-www-form-urlcoded'"> <param name="'param1'" expr="'value1'"/> <parm name="'p2'" expr="'v2'"/> <parm name="'p3" expr="'v3'"/> </session:fetch>
Note: v3 has two properties: "a" and "b". v3.a = 4 and v3.b = 5.
Here is how it maps to an HTTP POST/PUT message:
POST/PUT /data2/content HTTP/1.1 Host: www.business1.com Cache-Control: max-age=10, max-stale=10 Content-Type=application/x-www-form-urlencoded Content-Length=xx param1=value1&p2=v2&p3=[object object] ...
Here is an example of the <fetch> action with enctype = application/json:
<session:fetch requestid="_data.reqid" srcexpr="'http://www.business1.com/data2/content'" type="'plain-text'" method="'post or put'" timeout="'100'" maxstale="'10'" maxage="'20'" enctype="'application/json'"> <param name="'param1'" expr="'value1'"/> <parm name="'p2'" expr="'v2'"/> <parm name="'p3" expr="'v3'"/> </session:fetch>
Note: v3 has two properties "a" and "b". v3.a = 4 and v3.b = 5.
Here is how it maps to an HTTP POST/PUT message:
POST/PUT /data2/content HTTP/1.1
Host: www.business1.com
Cache-Control: max-age=10, max-stale=10
Content-Type=application/json
Content-Length=xx
{"param1":"value1","p2":"v2","p3":{"a":4,"b":5}}
...
Mapping Summary:
srcexpr attribute yields the host and path elements of the HTTP message.<param> elements depend on the enctype attribute. Note: the Content-Length header value will be set to the total length of the resulting body element. application/x-www-form-urlcoded — The result of evaluating the <param> elements yields the body element in the format p1=v1&p2=v2&p3=v3..., where p1, p2, p3,... are the names in the <param> elements, and v1, v2, and v3 are values that result from evaluating the corresponding expr attributes. If one of the values is not a simple type, we would put the result of the "toString()" function in the body, as in the GET case.application/json — The result of evaluating the <param> elements yields the body element formatted in JSON format, where each <parameter> name should appear as a top-level attribute.maxage attribute yields the Cache-Control header with the max-age directive.maxstale attribute yields the Cache-Control header with the max-stale directive.enctype attribute yields the Content-Type header value.type attribute yields the Accept header. Also the data type returned by the application server in the HTTP response will be checked against the type value. If it is different, an error.session.fetch will be raised — this exception is text-plain, which means any type of returned value is accepted.<response> mappingHere is an example of a positive <response> action:
<ws:response requestid="_event.sendid"> <param name="'param1'" expr="'value1'"/> <parm name="'p2'" expr="'v2'"/> <parm name="'p3" expr="'v3'"/> </ws:response>
Here is how it maps to an HTTP POST Response message:
HTTP/1.1 200
Content-Type=application/json
Content-Length=xx
{"param1":"value1","p2":"v2","p3":{"a":4,"b":5}}
...
Here is an example of a negative <response> action:
<ws:response requestid="_event.sendid" type="negative" resultcode="invalidparameter"> <param name="'description" expr="'Invalid value for parm2"/> </ws:response>
Here is how it maps to an HTTP POST Response message:
HTTP/1.1 500 invalidparameter
Content-Type=application/json
Content-Length=xx
{"description":"Invalid value for parm2"}
...
Mapping Summary:
<param> elements yields the body element formatted in JSON format, where each <parameter> name should appear as a top-level attribute. Note: the Content-Length header value will be set to the total length of the resulting body element. Content-Type header value will always be "application/json".Status-Code header value will either be "200" for positive responses or "500" for negative responses. resultcode attribute will be mapped to the Reason-Phrase header element.
|
Genesys 8.0 SCXML Technical Reference |
||
| External 2.0 Interfaces > | |||