Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Calling WCF service from SQL CLR Stored procedure

Author  Topic 

gunjanhshah
Starting Member

2 Posts

Posted - 2008-11-19 : 10:17:42
Hi



I am trying to call the WCF service from SQL CLR Stored procedure. I am able to create the procedure. but when I am executing the stored proc. it is showing the following error



Msg 6522, Level 16, State 1, Procedure SubmitFaxRequest, Line 0

A .NET Framework error occurred during execution of user-defined routine or aggregate "SubmitFaxRequest":

System.TypeInitializationException: The type initializer for 'System.ServiceModel.ClientBase`1' threw an exception. ---> System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.

The protected resources (only available with full trust) were: All

The demanded resources were: Synchronization, ExternalThreading

System.Security.HostProtectionException:

at System.ServiceModel.DiagnosticUtility.GetUtility()

at System.ServiceModel.DiagnosticUtility.get_Utility()

at System.ServiceModel.ClientBase`1..cctor()

System.TypeInitializationException:

at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()

at System.ServiceModel.ClientBase`1..ctor()

at OutboundFaxClient..ctor()

at StoredProcedures.SubmitFaxRequest()





What could be problem?







Gunjan

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-11-19 : 10:44:36
deploy it as Unsafe.
also look at this thread for what you have to do with xml serialization:
http://forums.microsoft.com/msdn/ShowPost.aspx?siteid=1&PostID=73977


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.1 out!
Go to Top of Page

gunjanhshah
Starting Member

2 Posts

Posted - 2008-11-19 : 11:39:35
Yes it seems it should work. I need to generate xmlserializer file using sgen. I am trying to run the sgen.exe "MYproject.dll" from my project location but it's showing this error and not able to create the xmlserializer.dll


Error: The top XML element 'PharmaFaxResponse' from namespace '' references dist
inct types SqlServerWCFService.Service1.PharmaFaxResponse and PharmaFax.PharmaFa
xResponse. Use XML attributes to specify another XML name or namespace for the e
lement or types.

If you would like more help, please type "sgen /?".

I have Service1 as a WCF.


Gunjan
Go to Top of Page
   

- Advertisement -