Send conditional link to workstation
Send Conditional Link Back to Workstation
This example shows how to call an external web application from the ACS, and then forward a response URL to open on the end-user's system.
The external web application is your own application server in which you can perform whatever logic you need. It can be hosted on any platform. When called by the ACS, the external application processes whatever parameters or posted content is sent by the ACS, and then returns a URL to the ACS as a plaintext document. The ACS processes then sends that response back to the workstation at which the original tag event occured.
In the example, the ACS calls the provided URI as an HTTP GET. It supplies two parameters, "login" and "password." The external web server called then responds with a URL containing a parameter containing a one-time session token that the client can use to log into the site.
This Specification can be copied from this page and used directly. Note, however, that the link returned is a loopback (127.0.0.1) and in will not resolve to an actual page (unless you run a web server on your client system).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<specification xmlns="http://www.touchatag.com/schema/configurator/specification-1.0">
<application>
<command id="default" name="default"/>
</application>
<blueprint>
<superblock id="*">
<!--The 'httpParams' property is delegated in the 'params.' These key/value pairs
are appended to the URL that the http-client block calls. They can be any
values that you need to pass to your external web application. Here we use the
example of a login name and password.-->
<property name="httpParams">
<map>
<entry>
<text>login</text>
<text>LoginName</text>
</entry>
<entry>
<text>password</text>
<text>PassWord</text>
</entry>
</map>
</property>
<breakdown>
<block id="method" ref="urn:touchatag:block:text-source">
<property name="Value">
<text>GET</text>
</property>
</block>
<block id="t2method" ref="urn:touchatag:block:text-to-http-method"/>
<block id="uri" ref="urn:touchatag:block:uri-source">
<!--This is the base uri for your external web application, which the ACS
will call, including whatever parameters you supplied in the properties
above.-->
<property name="Value">
<uri>http://www.touchatag.net/devnet/login.txt</uri>
</property>
</block>
<block id="params" ref="urn:touchatag:block:text2textmap-source">
<property name="Value">
<delegate as="httpParams"/>
</property>
</block>
<!-- The 'no-credential' block is used to make this example simple. If you have
an authenticated web application, then use the 'credential-basic-login' block
(and provide it the necessary inputs)-->
<block id="credential" ref="urn:touchatag:block:credential-no-login"/>
<block id="mime" ref="urn:touchatag:block:empty-text"/>
<block id="content" ref="urn:touchatag:block:empty-text"/>
<block id="request" ref="urn:touchatag:block:http-request-builder"/>
<block id="client" ref="urn:touchatag:block:http-client"/>
<block id="resp-proc" ref="urn:touchatag:block:http-response-processor"/>
<block id="t2uri" ref="urn:touchatag:block:text-to-uri"/>
<block id="wl" ref="urn:touchatag:block:web-link"/>
</breakdown>
<wiringscheme>
<wire from="method:out" to="t2method:in"/>
<wire from="t2method:out" to="request:httpmethod-in"/>
<wire from="uri:out" to="request:uri-in"/>
<wire from="params:out" to="request:params-in"/>
<wire from="credential:out" to="request:credentials-in"/>
<wire from="mime:out" to="request:mimetype-in"/>
<wire from="content:out" to="request:content-in"/>
<wire from="request:out" to="client:in"/>
<!-- The external web application that gets called should respond with a simple
plaintext page containing the complete uri that you want to open back at the
end user's system. That page is available on the 'content-out' pin of the
'http-response-processor' block.-->
<wire from="client:out" to="resp-proc:in"/>
<!-- You can now convert the response page from a text to a uri. -->
<wire from="resp-proc:content-out" to="t2uri:in"/>
<!-- Now you can send the uri to the 'web-link' block, and out as an action.-->
<wire from="t2uri:out" to="wl:in"/>
<shunt from="wl:out" to="action-out"/>
</wiringscheme>
</superblock>
</blueprint>
</specification>
