Troubleshooting Web Part property load errors

Recently I came across an interesting problem on a SharePoint site which is worth a post.

Issue:

The Content Editor Web Part’s “Rich Test Editor…” button gives “Cannot retrieve properties at this time” error and does not load the content.

webpartprop1

The alert was generated from JavaScript and since we failed to retrieve something it is good idea to use Fiddler2 to see what is going on.

Behind the scenes a web service call is initiated to [siteurl]/_vti_bin/WebPartPages.asmx to get the properties of the Content Editor Web Part. Using Fiddler you can check the actual communication under the Inspectors tab, I prefer the Raw view and it is nice to have the gzip decode feature to see the response in plain text.

In the request we can see that the soap Body contains the GetWebPart2 call with some parameters. More interesting things can be seen in the response: we have interesting namespaces like xmlns:wsse and notice the soap headers like wsa:Action.

If you ever used Web Services Enhancements for Microsoft .NET Framework version 3.0 (WSE 3.0) these soap headers will be familiar. It seems this enhancement causes some trouble for SharePoint JS code which parses the GetWebPart2 result.

webpartprop2

Using the IE 8 Developer tools it wasn’t so difficult to find where we fail on client side. “WebPartPages.asmx” appears in ie55up.js in the GetPropCol function.

Setting a breakpoint and inspecting the parsing results is very easy with this JavaScript debugging tool.

webpartprop3

Now we know what the problem is, the WSE 3.0 section in the web.config of the site overrides the default soapServerProtocolFactory which will be applied for the _vti_bin virtual directory as well resulting unexpected WSE headers in the WebPartPages.asmx results. In the website’s root web.config you will find these which controls the problematic setting:

<webServices>
<soapExtensionImporterTypes>
<add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</soapExtensionImporterTypes>
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</webServices>

Solution:

There is a web.config file in the _vti_bin virtual directory in "c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\"

Here we can override the soapServerProtocolFactory and set it back to the default.

Locate the </webServices> line and paste this above it in a single line:

<soapServerProtocolFactory type="System.Web.Services.Protocols.SoapServerProtocolFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Save the file.

Now the web part property can be loaded and WSE 3.0 can be enabled for other custom web services.