views:

72

answers:

2

Hi,
I have a server that I have no control over, it's JSON based and I've put together a simple proof of concept that calls the server using HTTPWebRequest etc and it works fine (if a little wordy since MS have removed all Synchronous I/O calls).

Is there a better way of doing this? I've been looking at WCF as an option but any stable and reasonably performant library should do the job. This is a new area for me so I'm a little unsure what the best practice is (or where to find it out)

Thanks in advance
Dave

+1  A: 

Once you've written the http request code once, you can easily abstract it away for reuse. You've already done the hard part :-)

Joel Martinez
This is true, I was just wondering if there was a more 'modern' way of doing it using an exisitng framework rather than hand coding all the HTTPWebRequest etc. It's not very complex code but I like to do things the 'best' way if possible
David Hayes
+1  A: 

Not sure whether it's the best method, but HttpWebRequest plus DataContractJsonSerializer are probably the best approach using classes from the Windows Phone library only -- plus HttpWebRequest's asynchronous methods ensure that your code won't block the UI thread when performing network requests.

Andréas Saudemont
The forced asynch is kind of a pain but I think probably the right decision for MS to take
David Hayes