Hi
public interface IHealthPortalLoginService
{
[OperationContract]
[WebInvoke(UriTemplate = "/loging",Method="POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
LoginDataContract loging(LoginDataContract objlocal);
}
[DataContract]
public class LoginDataContract
{
#region Fields
[DataMember]
public int LoginId { get; set; }
[DataMember]
public string EmailAddress { get; set; }
[DataMember]
public string Password { get; set; }
[DataMember]
public int DoctorId { get; set; }
[DataMember]
public string Role { get; set; }
[DataMember]
public bool IsActive { get; set; }
[DataMember]
public DateTime CreatedDate { get; set; }
[DataMember]
public string FavoriteQuestion { get; set; }
[DataMember]
public string Answer { get; set; }
[DataMember]
public int Status { get; set; }
[DataMember]
public int LabId { get; set; }
[DataMember]
public int FrontdeskId { get; set; }
#endregion
}
Web.config
<pre lang="xml"><?xml version="1.0"?>
<configuration>
<appSettings>
<add key="DBProviderType" value="1"/>
Password=PGI123;Pooling=true"/>
</appSettings>
<system.web>
<httpRuntime maxRequestLength="10000000"/>
<compilation debug="true"/>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="WcfContact.Service1" behaviorConfiguration="httpBehaviour">
<endpoint address="" binding="webHttpBinding" contract="WcfContact.IService1" behaviorConfiguration="httpEndpointBehaviour" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<service name="WcfContact.HealthPortalLoginService" behaviorConfiguration="httpBehaviour">
<endpoint address="" binding="webHttpBinding" contract="WcfContact.IHealthPortalLoginService" behaviorConfiguration="httpEndpointBehaviour">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<!--<bindings>
<webHttpBinding>
<binding name="StreamedRequestWebBinding"
bypassProxyOnLocal="true"
useDefaultWebProxy="false"
hostNameComparisonMode="WeakWildcard"
sendTimeout="00:05:00"
openTimeout="00:05:00"
receiveTimeout="00:05:00"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
transferMode="StreamedRequest">
<readerQuotas maxArrayLength="2147483647"
maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
</bindings>-->
<behaviors>
<endpointBehaviors>
<!--<behavior name="jsonBehavior">
<enableWebScript/>
</behavior>-->
<behavior name="httpEndpointBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="httpBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration></pre>
i can consume the service from c# app
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://xx.xx.xx.xx/ContactService/HealthPortalLoginService.svc/loging");
request.Method = "POST";
request.ContentType = @"application/json; charset=utf-8";
LoginDataContract local = new LoginDataContract();
local.EmailAddress = "satya@suryahospitals.com";
local.Password = "krishna";
local.CreatedDate = DateTime.UtcNow;
DataContractJsonSerializer jsonser = new DataContractJsonSerializer(typeof(LoginDataContract));
MemoryStream ms = new MemoryStream();
jsonser.WriteObject(ms, local);
string json = Encoding.Default.GetString(ms.ToArray());
request.ContentLength = Encoding.UTF8.GetByteCount(json.ToString());
using (Stream stream = request.GetRequestStream())
{
stream.Write(Encoding.UTF8.GetBytes(json.ToString()), 0, Encoding.UTF8.GetByteCount(json.ToString()));
}
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Stream respStream = response.GetResponseStream();
if (respStream != null)
{
//lbl.Text = new StreamReader(respStream).ReadToEnd();
LoginDataContract p2 = (LoginDataContract)jsonser.ReadObject(respStream);
}
its fine that my c# code is consuming the service
Problem is ,my ipad developer cant consume my service , is ther any problem in my code...