Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WCF服务合同和数据合同_Wcf_Messagecontract_Servicecontract - Fatal编程技术网

WCF服务合同和数据合同

WCF服务合同和数据合同,wcf,messagecontract,servicecontract,Wcf,Messagecontract,Servicecontract,我有以下代码 [ServiceContract(Namespace = "http://www.myweb.com/prod")] public interface IBaseService { [OperationContract] public string GetName(IDMessageContract ID) } [ServiceContract(Namespace = "http://www.myweb.com/

我有以下代码

  [ServiceContract(Namespace = "http://www.myweb.com/prod")]
        public interface IBaseService
        {
    [OperationContract]
    public string GetName(IDMessageContract ID)
    }

    [ServiceContract(Namespace = "http://www.myweb.com/prod/child")]
        public interface IChildService : IBaseService
        {}

    public class BaseService 
        { public string GetName(IDMessageContract ID)}

    public class ChildService: IChildService 
        {}

    [MessageContract]
    public class IDMessageContract 
    {
      public string ID{get;set;}
    }

在上面的场景中,我需要包含名称空间的GetName方法SOAP头“http://www.myweb.com/prod/child“

如果需要具有指定命名空间的SOAP头,则必须在消息协定中指定该头并使用其命名空间属性。比如:

[MessageContract]
public class IDMessageContract 
{
  [MessageHeader(Namespace="http://www.myweb.com/prod/child")]
  public string MyHeader { get; set;}
  [MessageBodyMember]
  public string ID{get;set;}
}

我想要包含名称空间的SOAP头