Tuesday, October 4, 2011

Migration to SharePoint 2010: Part 3 - Integrating the ASP.NET Web Service into a SharePoint page

In my final posting for this 3-part blog, I will detail the simple steps needed to integrate the ASP.NET Web Service we have worked on into your SharePoint site.

  1. Open Microsoft SharePoint Designer 2010.
  2. Click on Open Site.
  3. Under Site name enter the location to the SharePoint site you wish to connect too.  Click Open.
  4. Under the quick launch area (located to the left of the screen) expand the Site Objects tab.
  5. Click on Data Sources.  The summary area should now show you a list of data sources that are inside SharePoint.  Such as lists, document libraries, etc.
  6. Click on SOAP Service Connection in the ribbon, located at the top of the screen.  You will see the following:

  7. The Service description location is where you will want to put the path to your ASP.NET WSDL.  Should be something like https://localhost/ws-server/MyWebService.asmx?WSDL or whatever you setup.
  8. Click on Connect Now or Reconnect.  You should see your other fields light up.
The rest is pretty self-explanatory.  You can edit your parameters by clicking Modify at the bottom of the screen.  Or you can flag them to be set during runtime.  Under the General tab you can place a name and description to your SOAP service.  I didn't experiment with the Login tab, but it sounds simple enough.

To add this Web Service directly to a page in SharePoint do the following:
  1. Still remaining in SharePoint Designer, click on the Site Pages option under Site Objects.
  2. Add a new ASPX page.  You can add this page by:
    1. Click on the drop-down menu for Page from your ribbon at the top of the screen.
    2. Select ASPX and rename the file.
  3. Right-click on the newly created file from your summary screen.
  4. Select Edit File in Advanced Mode from the context menu.
  5. You will see some code but, what you are interested in is the code between the <form> tags.  Click and place your cursor between those tags.  Or whatever you have setup on the page to meet your needs.
  6. From your ribbon you will want to select the Insert tab.
  7. Under the Data Views & Forms category you will want to select Data View.  This will present you with a list of options.
  8. Scroll down until you find the SOAP service you created under Data Sources earlier.  If everything is successful, you should see a new DataFormWebPart that contains data fed back from the Web Service you just called.  If you get an error you may need to check your logs to determine why.
And that is it.  You have setup your ASP.NET Web Services server, created a Web Service on that server, added that Web Service to SharePoint, and inserted the Web Service directly into a page on the SharePoint site.

No comments:

Post a Comment