Wednesday, September 16, 2009

Publish ASP.net WebService to SharePoint Web Server

Click on File / New Web Site

o Select ASP.NET Web Service

o Select Language = Visual C#

o Select Location Type = File System

o Specify Location = Directory of your choice.

A suggestion would be: C:\Documents and Settings\-username-\My Documents\Visual Studio 2005\Projects\Webservice\YourWebServiceName

Visual Studio will create the files for the template “Hello World” web service in the directory path.

The Folder named YourWebServiceName will contain a Service.Asmx page and an App_Code subfolder.

The App_Code subfolder will contain a file named Service.cs

o Create a virtual server on the Web Server doing the following:

o Copy the following code and create an Install_Webservice.Bat file in the \WebService folder.

o Edit this file to replace “YourWebServiceName” with the name of the subfolder you created above

o Execute the file with a parameter of your Sharepoint Port 80 Web Site Name (typically “Sharepoint – 80”)

I NSTALL_WEBSERVICE “SharePoint – 80”

o Goto http://servername/wshelloworld/service.asmx and hopefully the webservice will display

:----------------------------------------------------------------------

: Install_Webservice.Bat

:

:

: This file was created by copying the Install.Bat file in this folder

: and removing all of the logic that dealt with the creation/loading

: of the BDC Applciation. This batch file just creates the virtual

: directory on the Sharepoint Web Server for the HelloWorld Webservice

:----------------------------------------------------------------------

@echo on

iisvdir /create %1 WSHelloWorld "%CD%\YourWebServiceName"

goto end

:usage

@echo.

@echo Syntax: INSTALL_WEBSERVICE website

@echo.

@echo Parameters:

@echo.

@echo Value Description

@echo ------------ ------------------------------------------------

@echo website Use either the site name or metabase path of

@echo site you want the webservice deployed

@echo.

@echo Example:

@echo.

@echo INSTALL_WEBSERVICE "SharePoint - 80"

goto end

Tuesday, September 1, 2009

InfoPath Forms vs. ASPX Pages in SharePoint Designer

When it comes to SharePoint 2007, one always has to make a choice whether to use InfoPath 2007 or design ASPX page. Here is a comparison I came up with on when It make sense to use InfoPath vs. design an ASPX

SharePoint forms

InfoPath 2007 form

ASPX Page ( using SharePoint Designer)

Design tools

InfoPath 2007- a Desktop application, part of Office Suite.

Since InfoPath forms are XML based, Programmers can theoretically design the InfoPath form in notepad

Can be designed in Microsoft© SharePoint Designer 2007 (aka Microsoft© FrontPage)

For programmers: Dependingonthe choice of tools, ASPX pages can be designed in notepad to Microsoft Visual Studio,

No-code design

Drag and drop support for form controls, table layouts etc. This is by far the best feature I have seen in InfoPath

SharePoint designer does provide drag and drop, simple validation and business logic without writting a code. However as far as User experience is concern, SharePoint designer is subpar compare to InfoPath 2007

Integration

You can submit an InfoPath forms to variety of sources including web services and SharePoint. Lookup data can also be brought from simple xml file to any line of business application and databases.


The built-in integration components to pull data from other sources are not as rich as InfoPath 2007.

Advanced design

This is big differential point. InfoPath 2007 forms out of the box look very nice. However does not support advanced scenarios

  • Tabs
  • Custom AJAX/DHTML
  • Show multiple/nested forms
  • Hand

SharePoint designer allows you to design advanced ASPX Page by direct coding html and JavaScript

Master Page

Out of the box, InfoPath forms are hosted in a new page without a master page. If you need to put a master page around your form for consistency, this require some work

1) Design a InfoPath form

2) Design a ASPX Page with master page

3) Drop <XMLFormView> control in the ASPX page and point to InfoPath

Complete Master page support

Compatibility

By design, a InfoPath form can be opened in

1) Any browser (e.g. IE, Firefox, Safar etc.)

2) Desktop App

You can optimize for Desktop, but you cannot optimize for a specific browser or an environment. This is a limitation with any form tools which support variety of tools. The choice of controls are limited to

This

Unfortunately, an ASPX pages can only be designed for browsers. But you have lot of choices to optimize for a specific browser.

Publishing to SharePoint

In spite of Microsoft's best efforts, the publishing to SharePoint is not as smooth as you would have expected from a non-programmers tool.

I love the "Blogging" feature of Word 2007; it's simple and intuitive for non-technical folks. I would have liked to see a similar approach in InfoPath 2007

Nonetheless with some training, I think InfoPath offers a great capability for publishing forms

In my personal opinion, designing an ASPX page and publishing to SharePoint is lot simpler in SharePoint designer than in InfoPath 2007

Error handling

Because InfoPath is designed for knowledge workers AKA non-programmers, the error handling is some what poor.

Most exceptions only make sense to the technical folks. But if you get some cryptic exceptions such as "Unknown error" or "exception occurred" , you are really out of luck unless you find some clues in the /12 hive log or the Event log

Pretty friendly and intuitive, you can do better error handling. You have more control on the flow compare to InfoPath 2007.