Recently I came across an interesting problem on a SharePoint site which is worth a post.
The Content Editor Web Part’s “Rich Test Editor…” button gives “Cannot retrieve properties at this time” error and does not load the content.
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.
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.
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:
<add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
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=18.104.22.168, 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.