如何在WCF中的客户端应用程序中向合同呼叫发送消息 [英] How to Message Contract Call in Client Application in WCF

查看:87
本文介绍了如何在WCF中的客户端应用程序中向合同呼叫发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在WCF服务中,我在接口中添加了消息Contract,并且该接口在service中实现.我也使用这项服务,但不知道如何在客户端应用程序中使用消息契约.


还可以告诉消息合同和DataContract之间的区别.
例如
这是接口

Hi All,

In WCF Service i have added message Contract in Interface and that interface are implemented in service . i also consume this service but dont know how to use message contract in clent application.


also tell diff between Message contract and DataContract.
e.g
This is Interface

[ServiceContract]
public interface IService
{

    [OperationContract]
    Employee11 GetDetailsss();
   
}

[MessageContract]
public class Employee11
{
    int empid = 0;
    string empname = "";
    string lastname = "";
	

	[MessageHeader]
	public int Empid
	{
		get { return empid; }
		set { empid = value; }
	}

	[MessageHeader]
	public string EmpName
	{
        get { return empname; }
        set { empname = value; }
	}
    [MessageHeader]
    public string EmpLastName
    {
        get { return lastname; }
        set { lastname = value; }
    }
}


我参加了服务课


i impemented in service class

public Employee11 GetDetailsss()
   {
       Employee11 e = new Employee11();
       e.Empid = 11;
       e.EmpName = "sanjay";
       e.EmpLastName= "Chaudhari";
       return e;
   }


但是我不知道如何在客户端应用程序中使用.

请回复我...


but i dont know how to use in Client Application.

Please reply me...

推荐答案

检查下面的链接,
http://www.c-sharpcorner.com /UploadFile/54db21/message-contract-in-wcf-hosted-on-web-app/ [
Check the link below,
http://www.c-sharpcorner.com/UploadFile/54db21/message-contract-in-wcf-hosted-on-web-app/[^]

You will get to know how to use it in Client App.

Hope this helps.
cheers


这篇关于如何在WCF中的客户端应用程序中向合同呼叫发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆