Winsmarts.com

Microsoft MVP

MVP Logo

Awarded the Microsoft MVP Award.

Hosted By

blah!bLaH!BLOG!!

Problem - Silverlight + WCF + SharePoint

Posted on 7/4/2008 @ 11:32 PM in #Sharepoint | 3 comments | 1747 views

UPDATE: For the solution, please see http://blah.winsmarts.com/2008-7-SilverLight_WCF_References_in_SharePoint_-_The_right_way.aspx

_________________________________________________________

I've asked everyone I knew, so as a last resort, I've emailed a bunch of MSFT folks hoping they come back with an answer on this. But, here is a problem I am running into with Silverlight + WCF + SharePoint, and seriously there is just nobody who can seem to give me a decent answer.

I am trying to generate a WCF proxy that I can use in Silverlight – and I don’t want to “right click add service reference” because it puts the WCF Config in the web.config. Given that I am using this in SharePoint, I want to not rely on web.config (because it would muck up the website’s web.config), I’d rather store that information in a list. Basically, I’d like to hand-generate my proxy – like you would with svcutil <endpoint> /async. Unfortunately svcutil generates code that won’t work with siverlight - specifically it uses System.Runtime.Serialization.<classes> that are not supported in Silverlight.

I was under the impression that Silverlight 2, Beta 2 would have shipped with a utility called slsvcutil.exe for this very purpose – but I can’t find it.

Can anyone tell me if

a) Did it not ship in B2?
b) If it did – where is it?

_______________________________

And before you answer - No I don't want to use "Add Service Reference" - I've tried that already, yes it works, I don't want to use it if I can help it because I don't want to rely on the web.config,
and
This is not an ADO.NET data service - this is a custom WCF service. So I cannot use DataSvcUtil
___________________

 


On 7/1/2008 4:34:41 PM Christopher Scrosati said ..
Hi,
The tool was not shipped in beta 2, and might probably not ship with RTM. I can give you one handy workaround though: If you use the Add Service Reference tool from VS, you will still get the proxy generated as if you used the command line. After you get it generated, go to your Project folder, there will be a new Service References folder. Inside, each individual service reference will be in its own subfolder. You need to get the Reference.cs file from each of them. Hope this helps! -Christopher Scrosati
Silverlight Web Services Team, Microsoft Obligatory Legal Notice: :)
This comment reflects my opinion only, and does not reflect nor imply the one of my employer.

On 7/1/2008 9:44:17 PM Rob Garrett said ..
This may seem wild, but have you consider CodeDOM? I needed to create a WCF proxy class on the fly for a service that changed contract (don't ask). I have some C# code to generate proxy code in a string, compile it, and execute the proxy. Might be overkill for what you're doing, but would solve a problem.

On 7/1/2008 11:04:40 PM Sahil Malik said ..
Chris - Thank you for your comments. I think the workaround will work, and it sounds easy enough! Awesome! Robert - CodeDOM? That too silverlight? I say cleaning the floor with an ear bud would be easier :), no? I guess it could be done, but wow! SM

Please post your comments:


Your feedback will be submitted for moderation, and will appear after it is approved.

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Site designed and maintained by Sahil Malik | All Rights Reserved. ©2007 WinSmarts.com.