You can control how cookies are set in the browser by adding a special cookies section to your Input XML file for a WEBROUTINE. For example:
<lxml:server-instructions>
<lxml:cookies>
<lxml:cookie name="USRID">
<lxml:value field-name="EMPNO"></lxml:value>
<lxml:expires field-name="EXPDAT"></lxml:expires>
<lxml:domain field-name="DOMAIN"></lxml:domain>
<lxml:path field-name="PATH"></lxml:path>
<lxml:secure field-name="SECFLAG"></lxml:secure>
<lxml:httponly field-name="HTTPFLAG"></lxml:httponly>
</lxml:cookie>
</lxml:cookies>
</lxml:server-instructions>
This example demonstrates the format of the cookies section that is required if you wish to set cookies in the browser from WEBROUTINE field values. The lxml:cookie element contains all the required cookie information. Its name attribute specifies the name used to store the cookie, as well as the LANSA field name that will contain the cookie value on subsequent WEBROUTINE requests.
Note: The cookies section must be inside the server-instructions section, as shown in the example.
The following table describes the elements:
|
The above elements may also specify a field-name attribute that contains the name of the field storing the cookie values as shown in the first example.
The following example show how cookie values can be specified directly in the XML:
<lxml:cookies>
<lxml:cookie name="LSTACT">
<lxml:value>Inquiry</lxml:value>
<lxml:expires>Thu, 31 Dec 2020 10:00:00 GMT</lxml:expires>
<lxml:domain>acme.com</lxml:domain>
<lxml:path>/home</lxml:path>
<lxml:secure>true</lxml:secure>
<lxml:httponly>true</lxml:httponly>
</lxml:cookie>
</lxml:cookies>