The main example demonstrating the use of the Touchpoint Server functionality in TDI, demonstrating example steps for creating both Provider and Initiator Touchpoint Instances, is shipped with the installation. The steps are spelled out in the document found at TDI_Install_dir/examples/TouchopintClient/Touchpoint_Example.pdf. In addition to that, a sample implementation of those steps is provided to demonstrate how they might look when written in the Java programming language. The Java code is structured in two packages, as follows:
This code depends on Apache HttpClient v3.x.
In order to provision a Touchpoint Instance, we need to send an HTTP POST request to the Touchpoint Server. The URLs for the requests are obtainable according to the application schema. For the purpose of this example we are using pseudo URLs as: <Resource Name URL>. We can obtain the appropriate URL at runtime.
Create a Touchpoint Instance Entry resource:
POST <Touchpoint Instance Feed URL> Body:<entry xmlns="http://www.w3.org/2005/Atom"> <id>some ID</id> <title>Provider Touchpoint Instance</title> <author><name>author_name</name></author> <content/> <category term="provider-tp" scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-role" /> <scmp:data xmlns:scmp="http://www.ibm.com/xmlns/prod/scmp" > <scmp:touchpoint> <scmp:propertySheet> <scmp:property propertyName="jdbcSource"> <scmp:value>some source value</scmp:value> </scmp:property> <scmp:property propertyName="jdbcDriver"> <scmp:value>the driver class</scmp:value> </scmp:property> <scmp:property propertyName="jdbcTable"> <scmp:value>the table name</scmp:value> </scmp:property> <!--The rest of the parameters required by a JDBC Connector--> </scmp:propertySheet> <scmp:admin-state>enabled</scmp:admin-state> </scmp:touchpoint> </scmp:data> </entry>
The Touchpoint Server will return a response similar to:
201 Created Location: <Touchpoint Instance Entry URL> Body: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_id</id> <updated>2010-02-17T18:33:55.302+02:00</updated> <title>Provider Touchpoint Instance</title> <link href="<Touchpoint Instance Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <link href="<Touchpoint Instance Entry URL>" type="application/atom+xml;type=entry" rel="edit"/> <link href="<Touchpoint Type Entry URL>" type="application/atom+xml;type=entry" rel="http://www.ibm.com/xmlns/prod/scmp#resource-type"/> <link href="<Touchpoint Instance Status Entry URL>" type="application/atom+xml;type=entry" rel="http://www.ibm.com/xmlns/prod/scmp#status"/> <author><name>author_name</name></author> <category scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-type" term="system:/Connectors/ibmdi.JDBC"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-role" term="provider-tp"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="touchpoint"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:touchpoint> <ns2:admin-state>enabled</ns2:admin-state> <ns2:propertySheet> <ns2:property propertyName="jdbcSource" xmlns="" xmlns:ns5="http://www.w3.org/2005/Atom"> <ns2:value>some source value</ns2:value> </ns2:property> <ns2:property propertyName=" jdbcDriver " xmlns="" xmlns:ns5="http://www.w3.org/2005/Atom"> <ns2:value>the driver class</ns2:value> </ns2:property> <!--The rest of the parameters required by a JDBC Connector--> </ns2:propertySheet> </ns2:touchpoint> </ns2:data>
Note that the Touchpoint Server changes the ID of the entry to guarantee its uniqueness.
The URL used for accessing the created Touchpoint Instance can be retrieved through the Status Entry URL. To do this, send an HTTP GET request to URL <Touchpoint Instance Status Entry URL>. The received response looks like this:
200 OK Location: <Touchpoint Instance Status Entry URL> Body: <?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_id</id> <link href="<Touchpoint Instance Status Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="touchpoint"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#aspect" term="status"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:touchpoint-status> <ns2:request-in>Touchpoint Provider Request-in URL</ns2:request-in> <ns2:op-state>available</ns2:op-state> </ns2:touchpoint-status> </ns2:data> </entry>
Create a Touchpoint Instance Entry resource:
POST <Touchpoint Instance Feed URL> Body: <entry xmlns="http://www.w3.org/2005/Atom"> <id>some ID</id> <title>Initiator Touchpoint Instance</title> <author><name>author_name</name></author> <content/> <category term="initiator-tp" scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-role" /> <scmp:data xmlns:scmp="http://www.ibm.com/xmlns/prod/scmp" > <scmp:touchpoint> <scmp:propertySheet> <scmp:property propertyName="jdbcSource"> <scmp:value>some source value</scmp:value> </scmp:property> <scmp:property propertyName="jdbcDriver"> <scmp:value>the driver class</scmp:value> </scmp:property> <scmp:property propertyName="jdbcTable"> <scmp:value>the table name</scmp:value> </scmp:property> <!--The rest of the parameters required by a JDBC Connector--> </scmp:propertySheet> <scmp:admin-state>enabled</scmp:admin-state> </scmp:touchpoint> </scmp:data> </entry>
The Touchpoint Server returns a response similar to:
201 Created Location: <Touchpoint Instance Entry URL> Body: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_ID</id> <updated>2010-02-17T18:33:55.302+02:00</updated> <title>Initiator Touchpoint Instance</title> <link href="<Touchpoint Instance Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <link href="<Touchpoint Instance Entry URL>" type="application/atom+xml;type=entry" rel="edit"/> <link href="<Touchpoint Type Entry URL>" type="application/atom+xml;type=entry" rel="http://www.ibm.com/xmlns/prod/scmp#resource-type"/> <link href="<Touchpoint Instance Status Entry URL>" type="application/atom+xml;type=entry" rel="http://www.ibm.com/xmlns/prod/scmp#status"/> <link href="<Touchpoint Instance Destination Feed URL>" type="application/atom+xml;type=feed" rel="http://www.ibm.com/xmlns/prod/scmp#tp-destination"/> <author><name>author_name</name></author> <category scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-type" term="system:/Connectors/ibmdi.JDBC"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-role" term="initiator-tp"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="touchpoint"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:touchpoint> <ns2:admin-state>enabled</ns2:admin-state> <ns2:propertySheet> <ns2:property propertyName="jdbcSource" xmlns="" xmlns:ns5="http://www.w3.org/2005/Atom"> <ns2:value>some source value</ns2:value> </ns2:property> <ns2:property propertyName="jdbcDriver" xmlns="" xmlns:ns5="http://www.w3.org/2005/Atom"> <ns2:value>the driver class</ns2:value> </ns2:property> <!--The rest of the parameters required by a JDBC Connector--> </ns2:propertySheet> </ns2:touchpoint> </ns2:data> <content/> </entry>
Note that the Touchpoint Server changes the ID of the entry to guarantee its uniqueness.
Furthermore, this time the Touchpoint Server response contains a Touchpoint Instance Destination Feed URL, which is needed for configuring the Touchpoint Destinations.
Next, we will add one Destination to the Initiator Touchpoint:
POST <Touchpoint Instance Destination Feed> Body: <entry xmlns="http://www.w3.org/2005/Atom"> <scmp:data xmlns:scmp="http://www.ibm.com/xmlns/prod/scmp" > <scmp:destination> <scmp:request-out>Request-out URL</scmp:request-out> </scmp:destination> </scmp:data> </entry>
The Touchpoint Server returns a response similar to:
201 Created Location: <Touchpoint Instance Destination Entry URL> Body: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_id</id> <updated>2010-02-18T10:52:35.108+02:00</updated> <link href="<Touchpoint Instance Destination Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <link href="<Touchpoint Instance Destination Entry URL>" rel="edit"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="tp-destination"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:destination> <ns2:request-out>Request-out URL</ns2:request-out> </ns2:destination> </ns2:data> </entry>
At this point, the Initiator Touchpoint Instance starts executing.
The steps needed to create a Touchpoint Instance in this Role are a combination of the ones for the Provider and Initiator roles.
First, we create a Touchpoint Instance Entry resource. This time the Touchpoint Instance Feed URL is concrete - http://<tp_server_host>:<tp_server_port>/<context_root>/tp-node/default/tp-type/virtual___Intermediary/tp-inst .
POST <Touchpoint Instance Feed URL> Body: <entry xmlns="http://www.w3.org/2005/Atom"> <id>some ID</id> <title>Intermediary Touchpoint Instance</title> <author><name>author_name</name></author> <content/> <category term="intermediary-tp" scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-role" /> <scmp:data xmlns:scmp="http://www.ibm.com/xmlns/prod/scmp" > <scmp:touchpoint> <scmp:propertySheet> <!--No parameters are required--> </scmp:propertySheet> <scmp:admin-state>enabled</scmp:admin-state> </scmp:touchpoint> </scmp:data> </entry>
The Touchpoint Server returns a response similar to:
201 Created Location: <Touchpoint Instance Entry URL> Body: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_ID</id> <updated>2010-02-18T11:20:00.546+02:00</updated> <title>Intermediary Touchpoint Instance</title> <link href="<Touchpoint Instance Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <link href="<Touchpoint Instance Entry URL>" type="application/atom+xml;type=entry" rel="edit"/> <link href="<Touchpoint Type Entry URL>" type="application/atom+xml;type=entry" rel="http://www.ibm.com/xmlns/prod/scmp#resource-type"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-type" term="virtual://Intermediary"/> <link href="<Touchpoint Status Entry URL>" type="application/atom+xml;type=entry" rel="http://www.ibm.com/xmlns/prod/scmp#status"/> <link href="<Touchpoint Destinations Feed URL>" type="application/atom+xml;type=feed" rel="http://www.ibm.com/xmlns/prod/scmp#tp-destination"/> <author><name>author_name</name></author> <category scheme="http://www.ibm.com/xmlns/prod/scmp#touchpoint-role" term="intermediary-tp"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="touchpoint"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:touchpoint> <ns2:admin-state>enabled</ns2:admin-state> <ns2:propertySheet/> </ns2:touchpoint> </ns2:data> <content/> </entry>
Note that the Touchpoint Server changes the ID of the entry to guarantee its uniqueness.
Next, we will add one Destination to the Intermediary Touchpoint:
POST <Touchpoint Instance Destinations Feed> Body: <entry xmlns="http://www.w3.org/2005/Atom"> <scmp:data xmlns:scmp="http://www.ibm.com/xmlns/prod/scmp" > <scmp:destination> <scmp:request-out>Request-out URL</scmp:request-out> </scmp:destination> </scmp:data> </entry>
The Touchpoint Server should return a response similar to:
201 Created Location: <Touchpoint Instance Destination Entry URL> Body: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_id</id> <updated>2010-02-18T10:52:35.108+02:00</updated> <link href="<Touchpoint Instance Destination Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <link href="<Touchpoint Instance Destination Entry URL>" rel="edit"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="tp-destination"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:destination> <ns2:request-out>Request-out URL</ns2:request-out> </ns2:destination> </ns2:data>
Finally, we will get the URL used for sending request to the Intermediary Touchpoint Instnace. As for the Provider Touchpoint, this is done through the Status Entry.
Send an HTTP GET request to the <Touchpoint Instance Status Entry URL>, available in the Touchpoint Instance Entry.
The Touchpoint Server returns a response similar to:
200 OK Location: <Touchpoint Instance Status Entry URL> Body: <?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/" xmlns:ns3="http://www.w3.org/1999/xhtml"> <id>generated_id</id> <link href="<Touchpoint Instance Status Entry URL>" type="application/atom+xml;type=entry" rel="self"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#resource" term="touchpoint"/> <category scheme="http://www.ibm.com/xmlns/prod/scmp#aspect" term="status"/> <ns2:data xmlns:ns2="http://www.ibm.com/xmlns/prod/scmp"> <ns2:touchpoint-status> <ns2:request-in>Touchpoint Intermediary Request-in URL</ns2:request-in> <ns2:op-state>available</ns2:op-state> </ns2:touchpoint-status> </ns2:data> </entry>