Hi.
To generate client proxy code of any service automatically in console application, we can approach 2 ways. One is open the VS 2010 command promot and type cammands [ svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config....] and generate client proxy. Second way is to generate at runtime using System.CodeDom.Compiler.CodeDomProvider.GenerateCodeFromCompileUnit() method to auto generate proxy code.
How to genete client proxy code using slsvcutil tool in silverlight application ?
I know one way, using System.Diaganostics.Process class to execute the slsvcutil tool to create proxy. But this not better method for user credintials, because we need to assign the credintials for every customers, I can't set credintials at runtime to everybody. So, We cant use this way.
Another way using System.CodeDom.Compiler.GeneratedCodeAttribute to assign the tool name,version. But this is not take tool as slsvcutil. It creates the proxy code but that is not correct.
So, How to create auto generate client proxy using slsvcutil at runtime itself ? Or Can we change the svcutil proxy to silverlight slscvutil tool code ?
Any solution kindly reply .
Thanks,
PRABAKARAN G.
Answer: 1
I don't think you can generate code à runtime with SL because there no compiler in the SL Framework...
Answer: 2
Hi PRABAKAR,
You can try this
slsvcutil http://localhost:2555/serviceTest.svc?wsdl /edb /namespace:"*,SilverlightApplication1.ServiceReference1" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%PROGRAMFILES%\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\System.Windows.dll"
This through you can generate your own Webservice..
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog