nikhilk / scriptsharp

Script# Project - a C# to JavaScript compiler, to power your HTML5 and Node.js web development.

Home Page:http://scriptsharp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding .NET based WCF service to Script# project

parthangshu opened this issue · comments

Hi,
I have one .NET based WCF service running in production (NOT RESTFUL service). I have to consume that WCF service to my Script# project. I am using Script# version 0.7.2.0. Whenever I am adding the service using Visual studio "Add Service reference", the service is getting added. But building the application it says "Error 5 The type or namespace name 'GeneratedCodeAttributeAttribute' does not exist in the namespace 'System.CodeDom.Compiler' (are you missing an assembly reference?"

So, I couldn't add the WCF service to my Script# project. I googled and found Script# has limited .NET based capabilities so it is not able to add WCF service. But I have to add the WCF service to my project to fulfill the requirement. But I can' t change the WCF service to RESTFul service because it is in production.

Please help!!!

Many thanks,
Partha

Unfortunately, there isn't anything that will scaffold consuming a WCF
service from Script#. If you're service speaks JSON, you could follow an
approach like this:
http://pranayamr.blogspot.ca/2010/12/steps-to-call-wcf-service-using-jquery.html
.

You might also be able to use something like this:
http://www.codeproject.com/Articles/627082/How-to-Consume-WCF-Service-using-JavaScript-Proxyto
generate a Javascript proxy. Then, in Script#, write an external
interface to reproduce the proxy.

On Mon, Mar 31, 2014 at 3:50 AM, parthangshu notifications@github.comwrote:

Hi,
I have one .NET based WCF service running in production (NOT RESTFUL
service). I have to consume that WCF service to my Script# project. I am
using Script# version 0.7.2.0. Whenever I am adding the service using
Visual studio "Add Service reference", the service is getting added. But
building the application it says "Error 5 The type or namespace name
'GeneratedCodeAttributeAttribute' does not exist in the namespace
'System.CodeDom.Compiler' (are you missing an assembly reference?"

So, I couldn't add the WCF service to my Script# project. I googled and
found Script# has limited .NET based capabilities so it is not able to add
WCF service. But I have to add the WCF service to my project to fulfill the
requirement. But I can' t change the WCF service to RESTFul service because
it is in production.

Please help!!!

Many thanks,
Partha

Reply to this email directly or view it on GitHubhttps://github.com//issues/414
.

Great to see folks already chiming in and helping... just some contextual stuff to keep in mind.

Script# is not about running .net code. Its about using c# language to author script apps, and use the capabilities of scripting environments (in browser, in node.js etc.). The answer to many of these "how do I do x in script#" questions is the same as "how do I do x in insert_your_script_environment".

So, as mentioned, in a JavaScript client, you'd likely (or maybe I should say ideally, since this isn't the case with WCF-based implementations sometimes) work with a service with a simple REST API that speaks JSON. The same applies in script#.