Invoking JSP from Silverlight
We have a website developed in Java, JSP runs in a apache server.
For Usability reasons it was decided to design a Silverlight web application and invoke the JSP URLs from silverlight
http requests such as http://mydomain.myapp.com/transaction/transactionlist.jsp would return the response in JSON format.
I was thinking that its possible to invoke these JSP URLs from Silverlight using System.web.httprequest and associated classes and parse the JSON response using the .net JSON base classes.
But I just want to know if this approach is correct.
I tried开发者_开发技巧 invoking a JSP url and the moment I got an Protocol Violation exception saying a generic "The operation is not valid due to the current state of the object. Did not find any other information that can help me. Any comments/Guidance is really appreciated.
See this question. It's certainly possible to do what you're doing, but you need to get the HttpWebRequest configured correctly. Specifically:
Uri uri = new Uri("http://mydomain.myapp.com/transaction/transactionlist.jsp");
HttpWebRequest webRequest = (HttpWebRequest)WebRequestCreator.ClientHttp.Create(uri);
webRequest.Accept = "application/json"; // Key
精彩评论