Blog Stats
  • Posts - 5
  • Articles - 0
  • Comments - 10
  • Trackbacks - 12

 

Wednesday, March 23, 2005

Exception of type Microsoft.SharePoint.SoapServer.SoapServerException was thrown


Today I've encountered an interesting issue with the SharePoint. I wrote a code to call a couple of SharePoint web services. But it did not work. SoapException occurred with the message "Exception of type Microsoft.SharePoint.SoapServer.SoapServerException was thrown.". Having played a little bit with the code I understood that the same exception occured whenever I called some SharePoint web method. I tried GetListCollection method of the Lists web service - it should work, i've used it often - but it would not work either. I had a look at the Detail property of the SoapException and saw "Method not found: System.Collections.IEnumerator Microsoft.SharePoint.SPListCollection.GetEnumerator". Now I started recalling that we'd had the same problem a long time ago when we used foreach loop to traverse a collection of sites or something else - it doesn't matter anyway, all SharePoint collections inherit the SPBaseCollection which implements the interface System.Collections.ICollection. The code then had compiled successfully but in runtime when it ran up to the method with the foreach, the application crashed with a runtime exception saying "Method not found: System.Collections.IEnumerator Microsoft.SharePoint.SPListCollection.GetEnumerator.". It looked like the collection object did not have the method GetEnumerator in runtime...

I searched in Google and found a few messages from people having the same problem but no one could answer them. I decided to dig it up to understand what really happened. I examined Microsoft.SharePoint.dll (from GAC) and STSSOAP.dll (it's in C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\ISAPI\BIN\). STSSOAP.dll contains SharePoint web services (Lists.asmx, Dws.asmx, etc.). Nothing was suspicious. SPBaseCollection really implements ICollection and its metod GetEnumerator. Also STSSOAP.dll references Microsoft.SharePoint.dll with assembly version 11.0.0.0. No application or publisher policy that might override versions existed.

I ran once again my console application that called SharePoint web service, launched Process Explorer and looked at modules loaded into w3wp.exe. Microsoft.SharePoint.dll assembly had version 11.0.0.0 and was loaded from the GAC. OK, I looked at STSSOAP.dll and here it was. There were two copies of it loaded into w3wp.exe with the same assembly version - 11.0.0.0! They were different in File Versions. The first one was 11.0.6361.0 (file version) and loaded from the Temporary ASP.NET Files (ASP.NET copies web application assemblies over there) and the second assembly was 11.0.4920.0 and loaded from the GAC.

I compared these assemblies and they were different in size: the 6361 was 200K, the 4920 - 180K. Both assemblies had the same Assembly Version - 11.0.0.0! And both referenced Microsoft.SharePoint.dll with Assembly Version 11.0.0.0. Moreover, the 6361 assembly was copyrighted all-right but the 4920 was marked "Unpublished work.". Cool, isn't it? :-) By the way, it's a good idea to put strings like "Unpublished work" before your application is released, but I guess you shouldn't distribute it before you remove such a string... :-) Anyway, after I had removed this unpublished assembly from the GAC everything worked like it should.

Now I wonder where it came from...

The very beginning...


Hi, Everyone!
My name is Stas Kondratiev and I've recently worked with the most amazing :-) Microsoft's product - BizTalk Server 2004. Despite the fact that you'll get a standard documentation out-of-the-box after installing BizTalk, it's not enough to get understanding why everything works the way it does. So here's the list of the best (IMO) information on the Internet:

So put yourself into the amazing and interesting world of BizTalk and take care!

Oh, by the way, if you can read Russian you're welcome to visit my Russian blog.

 

 

Copyright © Stas Kondratiev