从aspx.cs将Json数据传递给Wcf服务 [英] Passing Json data to Wcf service from aspx.cs
本文介绍了从aspx.cs将Json数据传递给Wcf服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<pre lang="c#"><pre lang="c#"><pre lang="c#"><pre lang="c#">
早上好,
我正在使用restful wcf服务概念,这是界面中服务的方法。
Hi,
Good Morning,
I am using restful wcf service concept and this is the method for the service in the interface.
[OperationContract]
[WebInvoke(Method = WebMethods.POST, UriTemplate = UriTemplates.CreateDoctorProfileUri, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
hxResponseDTO CreateDoctorProfile(CreateDoctorProfileArg createDoctorProfileArg);
and implemented the service
public hxResponseDTO CreateDoctorProfile(CreateDoctorProfileArg createDoctorProfileArg)
{
hxResponseDTO response = null;
try
{
bool actionResult;
string actionOutcome;
if (createDoctorProfileArg != null)
{
DoctorProfileDTO doctorProfileDTO = new DoctorProfileDTO
{
Prefix = createDoctorProfileArg.Prefix,
FirstName = createDoctorProfileArg.FirstName,
LastName = createDoctorProfileArg.LastName,
MiddleName = createDoctorProfileArg.MiddleName,
Sufix = createDoctorProfileArg.Sufix,
Gender = createDoctorProfileArg.Gender,
DateOfBirth = createDoctorProfileArg.DateOfBirth,
MaritalStatus = createDoctorProfileArg.MaritalStatus,
Image = createDoctorProfileArg.Image,
AadhaarNumber = createDoctorProfileArg.AadharNumber,
EmailId = createDoctorProfileArg.EmailId,
MobileNumber = createDoctorProfileArg.MobileNumber,
RegistrationNumber = createDoctorProfileArg.RegisterNumber,
RegistrationAuthority = createDoctorProfileArg.RegistrationAuthority,
Qualification = createDoctorProfileArg.Qualification,
TypeOfMedice = createDoctorProfileArg.TypeOfMedicine,
Specialization = createDoctorProfileArg.Specialization,
GroupId = createDoctorProfileArg.GroupID,
NoofPatients = createDoctorProfileArg.NoofPatients,
PlanSelected = createDoctorProfileArg.PlanSelected,
PaymentFrequency = createDoctorProfileArg.Paymentfrequency,
DiscountsProvided = createDoctorProfileArg.DiscountsProvided,
AuthorizationNote = createDoctorProfileArg.AuthorizationNote,
BillingAddress = createDoctorProfileArg.BillingAddress,
City = createDoctorProfileArg.City,
State = createDoctorProfileArg.State,
Pincode = createDoctorProfileArg.Pincode,
Telephone = createDoctorProfileArg.TelephoneNumber
};
// DoctorProfileResponseServiceDto response = new DoctorProfileResponseServiceDto();
actionResult = DoctorProfileController.CreateDoctorProfile(doctorProfileDTO, out actionOutcome);
response = new hxResponseDTO
{
Result = actionResult,
Message = actionOutcome
};
//MemoryStream = CommonUtils.serializeResponseObject<doctorprofileresponseservicedto>(response);
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
return response;
}
它将参数作为接受某些参数的类文件。
所以现在我需要从aspx.cs传递类文件,其属性与class相同。所以我在前端声明了类,我需要传递数据。
我该怎么办,请用正确的例子解释我?
where it is taking argument as the class file which accepts some parameters.
So now I need to pass the class file from aspx.cs with the properties same as the class.So I declared the class in the front end and I need to pass the data.
How can I do,please explain me with proper example?
推荐答案
访问这里......
http://www.c-sharpcorner.com/UploadFile/dacca2/understand-jquery-ajax-function-pass-json-data-to-service-m/ [ ^ ]
visit here...
http://www.c-sharpcorner.com/UploadFile/dacca2/understand-jquery-ajax-function-pass-json-data-to-service-m/[^]
这篇关于从aspx.cs将Json数据传递给Wcf服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文