//***************************************************************************** //* * //* "This sample program is provided AS IS and may be used, executed, copied * //* and modified without royalty payment by customer * //* (a) for its own instruction and study, * //* (b) in order to develop applications designed to run with an * //* IBM WebSphere product, either for customer's own internal use or for * //* redistribution by customer, as part of such an application, in * //* customer's own products." * //* * //* Product 5655-FLW, * //* (C) COPYRIGHT International Business Machines Corp., 2006, 2007 * //* All Rights Reserved * Licensed Materials - Property of IBM * //* * //***************************************************************************** //* * //* DISCLAIMER * //* * //* This material contains programming source code for your consideration. * //* These examples have not been thoroughly tested under all conditions. * //* IBM, therefore, cannot guarantee or imply reliability, serviceability, * //* or function of these programs. * //* ALL PROGRAMS CONTAINED HEREIN ARE PROVIDED TO YOU "AS IS", WITHOUT ANY * //* WARRANTIES (EXPRESS OR IMPLIED) OR SUPPORT WHATSOEVER, INCLUDING BUT * //* NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS * //* FOR A PARTICULAR PURPOSE. * //* * //***************************************************************************** /* * This sample shows the usage of the BFM Web Service API. * */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using WebServiceClient.MyBFMAccess; using Microsoft.Web.Services2.Security.Tokens; namespace WebServiceClient { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { // Get userid and password values and wrap it as UsernameToken: UsernameToken token = new UsernameToken(textBoxUserid.Text, textBoxPassword.Text, PasswordOption.SendPlainText); // Instantiate the proxy and attach the UsernameToken to the instance BFMWSService myService = new BFMWSService(); myService.RequestSoapContext.Security.Tokens.Clear(); myService.RequestSoapContext.Security.Tokens.Add(token); // Create an empty input object and run the query queryProcessTemplates queryInput = new queryProcessTemplates(); richTextBox1.Text = " ... computing ..."; this.Refresh(); ProcessTemplateType[] templateTypes = myService.queryProcessTemplates(queryInput); // Render the result: for each template, show three properties richTextBox1.Clear(); if (0 == templateTypes.Length) richTextBox1.Text = "No process templates found on server."; for (int i = 0; i < templateTypes.Length; i++) { richTextBox1.AppendText("Name: " + templateTypes[i].name + ", Auto-delete: " + templateTypes[i].autoDelete + ", Long running: " + templateTypes[i].executionMode + "\n"); } } catch (Exception exc) { // Whenever an error occurred, let the user know the details MessageBox.Show(exc.Message, "Error running sample", MessageBoxButtons.OK, MessageBoxIcon.Error); richTextBox1.Text = " ... sample failed with exception: " + exc.GetType(); } } private void button2_Click(object sender, EventArgs e) { try { // Instantiate the proxy BFMWSService myService = new BFMWSService(); richTextBox1.Clear(); // Get userid and password values and wrap it as UsernameToken UsernameToken myToken = new UsernameToken(textBoxUserid.Text, textBoxPassword.Text, PasswordOption.SendPlainText); Form2 f2 = new Form2(myService, myToken); f2.Show(); } catch (Exception exc) { // Whenever an error occurred, let the user know the details MessageBox.Show(exc.Message, "Error running advanced sample", MessageBoxButtons.OK, MessageBoxIcon.Error); richTextBox1.Text = " ... advanced sample failed with exception: " + exc.GetType(); } } } }