Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tom Castiglia Hershey Technologies

Similar presentations


Presentation on theme: "Tom Castiglia Hershey Technologies"— Presentation transcript:

1 Tom Castiglia Hershey Technologies tcastiglia@hersheytech.com Twitter: @tomcastiglia www.sanspug.org

2 Agenda  Building “web applications” with InfoPath and WCF Services Not just traditional “forms”  Using Data Connections and Rules to connect InfoPath forms to custom services or existing services Short Slide deck  Live InfoPath/SharePoint Demo

3 Target Audience  Middle Tier Developers Expose your middle tier business logic as a service (cloud or on-premise) Use InfoPath as a RAD tool to easily build web UIs that can easily consume your custom services  End-Users, Business Analysts & IT staff Use InfoPath as a RAD tool to easily build web apps and forms that can easily consume existing services

4 InfoPath Data Connections The “plumbing” in your InfoPath form Allows you to configure the connections between back-end systems and your form’s UI.

5 Types of Data Connections SOAP REST WCF Azure Web Services SQL Server ODBC OLE-DB Oracle Databases SharePoint File server XML files Convenient alternative to using a database table SharePoint lists / libraries

6 InfoPath Rules  Rules are like the application programming logic for your form  Rules can be used to… Pass form data as an input parameter to a data connection Bind the data connection’s return values to other form fields

7 Types of Rules Specify an error message that will be displayed condition is false Validation Changes “look and feel” of the UI elements (show/hide, color, fonts, etc.) Formatting Connect data connections to your form fields Set input param values from form fields Assign results from back to the fields Action

8 Why use Data Connections & Rules?  Build rich, functional applications without code  Common examples: Populate a drop-down field with values. Generate unique, incrementing ID values Pre-fill portions of the form with existing data Send data to back-end databases and applications Perform real- time validations of user input Incorporate forms into workflow processes

9 Data Connection Tip #1 Limited to tables and views Cannot call a stored procedure directly Database connections Requires a developer to implement services WCF is “best-practice” Web Service connections

10 Data Connection Tip #2  When connecting to WCF services, typically use the “Receive data” option. (Even if your service is used to save, update or delete data.)  Use “Submit data” only when you want to submit (and close) the entire form.

11 Data Connection Tip #3  When connecting to a WCF service, select the option called “SOAP Web service”.  This applies to any type of service that has a WSDL file (SOAP, WCF, Azure, Java)  You must know the URL for your WSDL if you select this option.

12 Data Connection Tip #4  You can specify default values for the input parameters of your data connections, if user input is not required.

13 Data Connection Tip #5  Uncheck the option to “Automatically retrieve data…”  This option is checked by default.  Leave enabled if the data connection does not require user input.

14 Data Connection Tip #6 This allows connections to be re-used on multiple forms Prevents security warnings from being displayed when form is used Start by setting up data connections Save connections to a Data Connection Library Approve the Data Connections in the library

15 Demo - Universal auto-incrementing Id  Implement new service using SQL Server WCF (VS2010 & C#)  Easily reusable for all InfoPath forms  This technique is a “best practice”, compared to using SP list ID values or DocumentId

16 FormCounters (table)  Simple table, with two columns: FormName (VARCHAR (50), PK) FormCounter (INT)  Used to track the counters for any number of different forms

17 GetIncrementedCounter procedure

18 Validate that the specified FormName is valid and raise an exception if a bogus value is provided This will save much troubleshooting time down the road when someone accidentally tries to use an incorrect value for the FormName

19 GetIncrementedCounter procedure To ensure concurrency in a multi-user environment, two things are important: Using a Transaction Proper row level locking UPDLOCK XLOCK

20 Configuring IIS 7 for a.NET 4.0 based WCF Service If you plan to deploy your service on the SharePoint WFE, then be sure to run that web site on a port other than the port(s) used by SharePoint Make sure the web application is in an application pool configured with.NET 4.0 framework Identity set to the built-in “ApplicationPoolIdentity” Create a new application under your web site to host the service

21 Configuring SQL Server security Add new windows login to SQL Server: “IIS APPPOOL\DefaultAppPool” Give this account access to the database hosting the FormCounters table Grant Execute Permissions to the GetIncrementedCounter procedure

22 Create WCF service in Visual Studio 2010 From New Project dialog, select WCF Service Application Define ServiceContract and DataContracts Implement service functionality Build Publish to IIS


Download ppt "Tom Castiglia Hershey Technologies"

Similar presentations


Ads by Google