Problem calling ws from sqlclr
Hi all,
I've got a stored procedure that calls a webservice, however when executed I keep getting the following error:
A .NET Framework error occurred during execution of user defined routine or aggregate 'xxxxx':
System.IO.FileNotFoundException: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Systemet finner ikke angitt fil.
System.IO.FileNotFoundException:
at System.Web.Services.Protocols.RequestResponseUtils.CreateResponseExceptionString(WebResponse response, Stream stream)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
Any suggestions what might be wrong? I'm running the April CTP of SQL Server and beta2 of VS.
Thanks in advance!
Best regards,
Anders
[1081 byte] By [
aaa] at [2008-2-7]
This has been fixed in post beta2 .NET framework builds and would be available only in the .NET framework that would ship with the Sept CTP of SQL Server.
A workaround till then for evaluation and development of your code would be to register System.Web.dll as an unsafe assembly. You should unregister it as you move to Sept CTP.
Thanks,
-Vineet.
Hi Vineet!
Thanks for your reply. I've already tried registering System.Web.dll, but that fails
with the following error:
Create failed for SqlAssembly 'System.Web'. (Microsoft.SqlServer.Smo)
[snip]
Assembly 'system.drawing, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' was not found in the SQL catalog.
Warning: The Microsoft .Net frameworks assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in SQL Server hosted environment. r (Microsoft SQL Server, Error: 6503)
I have, however, resolved the problem - It was due to the fact that the procedure
failed authentication at the webservice it was calling, and thus resulting in an exception. I assume that with the build I'm running (and up to the Sept CTP)
other exceptions from a webservice might result in the same exception I got?
(i.e. not the actual exception thrown)
Best regards,
Anders
aaa at 2007-9-9 >

That is correct. The dependency of System.Web.Services on System.Web would be removed for generating exception messages from Sept CTP onwards.
To register any assembly you need to have all of its dependencies in the same directory or already registered in the database. If you register System.Web from the Framework install directory (usually C:\WINDOWS\Microsoft.NET\Framework\<version>) it would register without throwing the error you are seeing.
Thanks,
-Vineet.