Archive

Posts Tagged ‘web services’

Shot: OWSSVR.dll and xml data

Xml data can be received not only with original Sharepoint 2010 *.SVC services, but also with Sharepoin Foundation RPC protocol.

We found interesting case yesterday, so often used format didn’t work:

http:// [site address] /_vti_bin/owssvr.dll?Cmd=Display&List={1}&XMLDATA=TRUE

Situation was resolved only after adding additional parameter:

query=*

Besides, we discovered that additional parameters can be used. For example, “view” (without it default view is shown) or for  filtering values.

More information:

Dependent lookups fields functionality for Sharepoint

Case description:

You have pair of fields. One field (field2) depends on value of second one (field1). You want to realize that functionality on form new and edit form.

Resolution

Use prepared javascript-based solution “SharePoint Cascade Lookups” or InfoPath. We chose the first variant as the way we can apply for Sharepoint 2010 Standard Edition.

1. Download script and upload it to Sharepoint library

2. Create list with field1 values (list1 )

Name: List1

Columns: Title1 (field1 value)

3. Create list with field2 values

Name: List2

Columns:

1. Title2 (field2 value)

2. Field2 (lookup to List1)

4. Add to required list (“ListWithFunctionality”) lookup fields. Fields refers to List1 and List2 (FieldToList1DisplayName, FieldToList2DisplayName)

5. Add to New and Edit forms of required list (“ListWithFunctionality”) HTML form webpart.

6. Edit content of newly added webpart with following text.

<script type=”text/javascript” src=”/pathToScript/spcd.js”></script>
<script type=”text/javascript”>
var ccd1 = new cascadeDropdowns(“FieldToList1DisplayName”, “FieldToList2DisplayName”, “Field2”, “List2”, “Title2”);
</script>

The main moments here are:

  • Set “HTML form web part” with script lines after “New/Edit list form”
  • 1st and 2nd parameter of cascadeDropdowns objects are DisplayNames of the fields, 3rd and 5th are internal names

Some links:

Everything I need to know about RSS and XML Viewer Web Part (WP)

Firstly, I’d like to thank some great persons who share IT knowledge and experience with community. Secondly, I always tried to test some Web parts and standard functionality. So It’s time to share this knowledge with you.

Of cource, there is desclaimer

Everything you meet here is just my suggestions according my Sharepoint experience and my point of view on problems and all it’s may not be the ultimate truth

Purpose

RSS and XML view Web part are used for representation of XML data. RSS Web part provides us ability to work with RSS format (subformat of XML),  while XML Web Part is used to show XML in your own HTML-page.

All this web parts may use custom XSL-transformations to customize data view. Common behavior of WPs is same: you define source link for xml-file and define necessary XSL-transformation, but in same cases we can get different error messages.

RSS Viewer WP is available just in Sharepoint Server edition, but not in Sharepoint Foundation (WSS). But you may do similar things with more common XML Viewer WP (http://weblogs.asp.net/gunnarpeipman/archive/2008/01/02/sharepoint-how-to-display-blog-feed-using-xml-web-part.aspx)

 

Connect to sources and proxy-services.

I suppose we will use the WPs with external sources, e.g. news sites. As you understand It can not be so simple if you are inside corparate network: beetween your Sharepoint farm and Internet stands firewall or proxy-servers.

Error

In following situation your RSS Viewer WP may show following error message:

The webpart has timed out

Resolution

Edit your web.config file with  following code snippet for you web-application:

  <!—… –>
  <system.net>
    <defaultProxy>
      <proxy usesystemdefault="False" proxyaddress="http://proxyserver:proxyport&quot;
           bypassonlocal="True" />
    </defaultProxy>
  </system.net>

   <!—… –>

Check the account under application pool is running. It has proper permissions to get access to source link.

Or increase the value of the Timeout attribute for WebPartWorkItem from the default 5000 milliseconds to a higher value.

You may use following URL to test your RSS Viewer WP:

http://feeds.bbci.co.uk/news/system/latest_published_content/rss.xml

 

Anonymous sessions problems

As I discovered all this web parts are used to communicate with another side not providing any authentication information. That’s why it very important to know about some assumptions i discovered.

Reason

XML and RSS Web part works only with anonymous access to sources.

Errors:

RSS Viewer WP doesn’t support authenticated sources and the following error is self-explained:

image

"The RSS webpart does not support authenticated feeds”

As for XML Viewer WP we see unodinary error, but the reason mey be the same:

image

Cannot retrieve the URL specified in the XML Link property. For more assisstance, contact your site administrator

Resolution

Discovering Internet you may meet following links that can resolve you access problems :

To get access to SharePoint Web Service – owssrv.dll, lists.asmx, feed.rss
    You need to provide rights for app pool account and anonymous access to objects:
  • Provide anonymous access for the web application and list & libraries section at the site collection
  • Web application pool account should be a part of WSS_WPG, ISS_WPG and WSS_ADMIN_WPG

Don’t try to get access to SharePoint getdata.svc Web Service

I spent a lot of time trying to get access to this useful REST web-service, but it can’t work with anonymous sessions used by WPs. You can look through all this service limitations : http://allthatjs.com/2012/07/20/limitations-of-sharepoint-listdata-svc/

I spent a lot of time but always got this error:

XML Viewer The Web Part has timed out.

 

Some useful links:

WCF Testing – Web services early tracing

Web service development is not so difficult as you may imagine if you know some tips. One of this tips is WCF tracing! Creating your web service you may debug it and never get reaction because debug breakpoints are not reachable and problems are inside settings of web service or client. Wrong configuration parameters of client is problem of communication between partners.

So, we have a medicine for you: WCF tracing.

1. Open WCF config editor. Write svcconfeditor command in commandline or use “Service Configuration Editor” link in Microsoft Visual Studio 2010 folder.

image

2. Open your config file.

image

If you use Sharepoint and it’s application folder (12 or 14)  to create your web services, use web.config that is saved in inetpub folder of IIS.

Default folder:C:\inetpub\wwwroot\wss\VirtualDirectories\[Number of web app port]\

3. Correct Diagnostics part of config.

image

Switch on MessageLogging or/and Tracing and make specific rules.

4. Make iisreset

5. Open trace files with svctraceviewer and find your problem (highlighted with red colour).

image

 

Links:

1. Bacis info (http://blogs.msdn.com/b/madhuponduru/archive/2006/05/18/601458.aspx)

2. Information about trace levels (http://msdn.microsoft.com/en-us/library/ms732023.aspx)

3. WCF Tracing FAQs (http://www.codeproject.com/Articles/36031/WCF-Tracing-FAQs)

WCF Web Service Configuration in Sharepoint 2010 environment (Factory vs. web.config)

12.02.2012 1 comment

I spent a lot of time trying to resolve problems with publishing WCF web service in Sharepoint 2010 environment.

1. I created programmatically new WS with specific contract

2. I created svc file with reference to my contract assembly like other svc-services inside Sharepoint ISAPI folder.

Example of Default ListData.svc:

<%@ServiceHost language="C#" Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressDataServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Service="Microsoft.SharePoint.Linq.ListDataService, Microsoft.SharePoint.Linq.DataService, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

3. For specific clients (JS, Infopath) i tried to create specific web.config configuration for service. I put svc-configuration and web.config files inside own folder in ISAPI, but always got 500 error sending web request to WS.

I thought that Web config settings will be merged or overriden with settings made by factory. But is was my mistake.

So, I made following conclustion: using Factory for generating WCF Service you cannot use web.config to declare new settings. Make all editions using code inside your own factory.

Why was it made so?

The administrator can choose from multiple authentication schemes supported by SharePoint Foundation or can enable multiple authentication schemes and assign multiple addresses to the Internet Information Services (IIS) web application. In these cases, a WCF service requires a separate endpoint for each authentication scheme and address. Because this kind of configuration information cannot be provided in a static form, a web.config type of configuration cannot be used. The solution is dynamic configuration, or in WCF terms, programmatic configuration.

Links:

  1. WCF Services in SharePoint Foundation 2010 (http://msdn.microsoft.com/en-us/library/ff521586.aspx)
Categories: Web services Tags: , ,