I want to develop a Web application with WCF
service that supports not only My web application but Mobile Application as well which is doing all the manipulation using JSON
.
So can someone suggest the best architecture for it and how to implement it?
Update
Here is what i have tried so far
1) This is the structure of my application
2) IHelloService.cs
3) HelloService.svc
4) Business Logic in Factory - ServiceProfile.cs
4) Entity - Profile.cs
5) Calling a Service on Page
This will work fine!! but when i access this service through android app that must return JSON. That is where i got stuck. how to use same service that can be used both side.
To test this service i used ajax call as below.
$.ajax({
url: "Service/HelloService.svc/TestService",
type: 'POST',
//dataType: 'json',
//contentType: "application/json; charset=utf-8",
data: JSON.stringify({ "_Profile": [{ "Name": "Aijaz from JSON" }] }),
success: function (data) {
$('[Id$="Label1"]').text(data);
},
error: function (e) {
},
complete: function () { }
});
Create a restful WCF service. This service will provide data in JSON format which you can use in Web app / Mobile app.
More info: How to create such service. http://www.compilemode.com/2015/09/creating-wcf-rest-service-to-get-json.html
I hope this is what you wanted.
I think you missed the binding details webHttpBinding. :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.