WCF SOAP WSDL Webservices and AngularJS

Hi guys,

I have a WCF webservice and then a created some JSON compatible methods that understand and return JSON data. Now, how can I make that work and consume using AngularJS?? Need code example. Thanks

Hi @thiago - the Angular docs on $http are prob the best place to start. They have a few examples showing you how to use GET and JSONP etc.

I can’t see how the docs can help me, It’s all about RESt only. Let me explain it better: As I said, my problem is more specific cause it’s a WCF SOAP WSDL WEBSERVICE that returns and consumes JSON. The webservice is working but I just can’t find a solution to make it work with AngularJS. Please, Help me

I’ve not worked with WCF web sevices before.
Can you call your API end points as URLs?
How do you get them to return JSON?

There are some specific methods that I serialize the content to JSON.

Can you call the API endpoints with a URL?
If not, then I think you will need to modify your WCF methods so they can be accesed by calling a URL otherwise I’m not sure how you will call them from javascript or Angular.

You mean like "localhost:50451/SVCWebservice.svc/methodName?param1=hello&param2=world"
It should be enabled by default, am i right or not??

Yeah, like that. I don’t know if that’s enabled by default as I haven’t worked with WCF services before.

Try using the Angular $http GET method to call the URL that returns json and see if that works.

Also, if you have control over the webservice, I’d consider re-writing it using the Web API framework which is the preferred way of creating APIs in .NET nowadays. It’s a lot easier to configure than WCF and means you can get some nice RESTful URLs for your Angular app to connect to.

Try this tutorial:

1 Like