Please try with webHttpBinding to create a Restful wcf service, since Android did not provide any tool to help consuming SOAP web service, it will be more convenient to consume a rest service. You may check below blogs which include samples on how to implement
this.
To provide data to the Android or iPhone use OData service, .Net also has WCF Data Service. OData service/WCF Data serivce provide Open data, Odata build upon web technologies such as HTTP, ATOM and JSON. Good thing about is you do not have to write contracts
(When you use WCF Data Service), just use Entity Framework, setup entities relationship, implement entities into the WCF Data service (one line code for each entity) it will allow you to do CRUD using LINQ TO SQL. Below is the code example of implementation
of entities into the WCF Data service.
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
namespace WCFDataService
{
public class WcfDataService1 : DataService< TestDBEntities >
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
// config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.SetEntitySetAccessRule("Tbl_Category", EntitySetRights.All);
config.SetEntitySetAccessRule("Tbl_Product", EntitySetRights.All);
config.SetEntitySetAccessRule("Tbl_ProductVariant", EntitySetRights.All);
config.SetEntitySetAccessRule("Tbl_Discount", EntitySetRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
}
vikramchowda...
Member
484 Points
216 Posts
Wcf service problem when accessing into the android
Nov 15, 2012 01:30 PM|LINK
Hi,
The Wcf service was working fine when accessing to dotnet. But when i am trying to access same service to the andriod application
its getting error.
i am using basicHttpBinding.
Please help regarding this.
Sincerely,
Vikram
Haixia Xie -...
Contributor
3023 Points
294 Posts
Microsoft
Re: Wcf service problem when accessing into the android
Nov 16, 2012 07:44 AM|LINK
Hi vikramchowdary,
Please try with webHttpBinding to create a Restful wcf service, since Android did not provide any tool to help consuming SOAP web service, it will be more convenient to consume a rest service. You may check below blogs which include samples on how to implement this.
#Comsuming WCF Services With Android
http://fszlin.dymetis.com/post/2010/05/10/Comsuming-WCF-Services-With-Android.aspx
#Android with WCF Services
http://wyousuf.wordpress.com/2012/03/01/android-with-wcf-services/
Hope it can help you.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
pratiksolank...
Member
271 Points
76 Posts
Re: Wcf service problem when accessing into the android
Nov 22, 2012 06:57 PM|LINK
Hi,
To provide data to the Android or iPhone use OData service, .Net also has WCF Data Service. OData service/WCF Data serivce provide Open data, Odata build upon web technologies such as HTTP, ATOM and JSON. Good thing about is you do not have to write contracts (When you use WCF Data Service), just use Entity Framework, setup entities relationship, implement entities into the WCF Data service (one line code for each entity) it will allow you to do CRUD using LINQ TO SQL. Below is the code example of implementation of entities into the WCF Data service.
For more information watch video from here http://msdn.microsoft.com/en-us/data/bb931106
If you are in hurry then use this link which describe using EntityFramework
http://www.codeproject.com/Articles/135490/Advanced-using-OData-in-NET-WCF-Data-Services
using System.Data.Services.Common; using System.Linq; using System.ServiceModel.Web; using System.Web; namespace WCFDataService { public class WcfDataService1 : DataService< TestDBEntities > { // This method is called only once to initialize service-wide policies. public static void InitializeService(DataServiceConfiguration config) { // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. // Examples: // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead); // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All); config.SetEntitySetAccessRule("Tbl_Category", EntitySetRights.All); config.SetEntitySetAccessRule("Tbl_Product", EntitySetRights.All); config.SetEntitySetAccessRule("Tbl_ProductVariant", EntitySetRights.All); config.SetEntitySetAccessRule("Tbl_Discount", EntitySetRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } }Regards
Pratik