Problem with Web Services in Unity.

Hello everyone.

I’m trying to communicate with a simple web service with unity, but with no sucess.(got tons of tutorials, forum posts and etc)

To begin, all i want to do is recieve some information from the service.
I’m using localhost for my tests. My service is written in c# (.net plataform. asmx, aspx and etc.)

I cant even get the XML generated by the service.

Anyone knows some good tutorial to follow? i just need retrive the XML from a service.

i’m desperate =X

Thanks for the help…

I had the same task a few months ago, that tutorial helped me very much: http://www.paultondeur.com/2010/03/23/tutorial-loading-and-parsing-external-xml-and-json-files-with-unity-part-1-xml/

Hmm… this makes me curious… if you’re consuming web services and not streaming assets, I wonder if RestSharp works with Unity. I’ll have to give it a try this weekend. If it does, RestSharp is a great library for abstracting away the work.

Thanks for the help guys.
Tomorrow i will try again.
Any news i will post here

RestSharp works great with web services, and is accessible from unityscript. We just used it for a leaderboard feature last week, including GET, POST and PUT verbs, and it worked beautifully. The only thing I wasn’t able to get working in unityscript was the typed Execute function, as I’m not sure what the unityscript syntax would be for that.

The reason for this is because the serializer is terrible. This isn’t a Unity specific thing. Anything more than basic objects and you can run into issues. I use RestSharp for communicating between .NET applications and MVC4 WebAPI endpoints and have always had headaches with the default Execute implementation. This changed in later versions of RestSharp because they removed the dependency for JSON .NET, but you can always switch and use it as the serializer for RestSharp. I generally just read the raw response and use JSON .NET to deserialize it.