Call a method from a wsdl generated class
Just wanted to ask if I can call a method coming from a WSDL generated开发者_JS百科 class inside javascript. Thanks!
If you mean a class generated by importing the WSDL using Add Service Reference / svcutil, then no, since those tools don't support generating javascript clients.
If you want to access a WCF service via javascript, you should add a non-SOAP (REST) endpoint to the service, since it can take / return JSON data (which is easy to create / consume in JS). You can also take a look at http://wcf.codeplex.com, which has an extension for accepting the native data format used by jQuery's ajax calls (application/x-www-form-urlencoded), along with some samples.
精彩评论