The following code fragments show the Page_Load method of a sample ASPX page. The page contains a single web control, a ListBox named listBooks. A non-pooled session is opened and the BOOKLIST XML document is called to return the data in the BOOKS TIBCO Object Service Broker table. The GetTable method is used to extract the data as an ADO.NET DataTable object. A “For Each” loop is used to extract the values of the TITLES attribute so that they can appear in the ASPX page’s ListBox.
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Dim eSession As eCTSnet.eCTSsession = New eCTSnet.eCTSsession
Dim sessParms As Hashtable = New Hashtable
sessParms("HOST") = "USR40"
eSession.OpenApplication(sessParms)
eSession.RunXmlDoc("BOOKLISTNET")
Dim table As DataTable = eSession.GetTableFromDocument("BOOKLISTNET")
For Each row In table.Rows
listBooks.Items.Add(row("TITLE"))
/// Summary description for WebForm2.
public class WebForm2 : System.Web.UI.Page
protected System.Web.UI.WebControls.ListBox listBooks;
private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here
eCTSsession eSession = new eCTSnet.eCTSsession();
Hashtable sessParms = new Hashtable();
sessParms.Add("U", "USR40");
sessParms.Add("P", "USR40");
sessParms.Add("HOST", "USR40");
eSession.OpenApplication(sessParms,
eCTSnet.eCTSsession.Mode.Pooled);
eSession.RunXmlDoc("BOOKLISTNET");
DataTable dt = eSession.GetTableFromDocument("BOOKLISTNET");
foreach (DataRow row in dt.Rows)
listBooks.Items.Add( (string)(row["TITLE"]));
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
private void InitializeComponent()
this.Load += new System.EventHandler(this.Page_Load);
Next, in the generated .asmx file, add the following Visual Basic code:
Dim oSession As eCTSnet.eCTSsession = New eCTSnet.eCTSsession
Dim userParms As NameValueCollection = New NameValueCollection
oSession.OpenApplication()
userParms("KEY") = BookID
oSession.RunTrans("BOOKDETADO", userParms)
GetBookDetails = oSession.GetTable()