110,539
社区成员
发帖
与我相关
我的任务
分享
using System.Data;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public interface IWcfService
{
string GetHello();
DataSet GetLocInfo(string locationCode);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName="GetHello", Namespace="http://tempuri.org/")]
public partial class GetHelloRequest
{
public GetHelloRequest()
{
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName = "GetLocInfo", Namespace = "http://tempuri.org/")]
public partial class GetLocInfoRequest
{
public GetLocInfoRequest(string locationCode)
{
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName="GetHelloResponse", Namespace="http://tempuri.org/")]
public partial class GetHelloResponse
{
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Namespace="http://tempuri.org/", Order=0)]
public string GetHelloResult;
public GetHelloResponse()
{
}
public GetHelloResponse(string GetHelloResult)
{
this.GetHelloResult = GetHelloResult;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName = "GetLocInfoResponse", Namespace = "http://tempuri.org/")]
public partial class GetLocInfoResponse
{
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Namespace="http://tempuri.org/", Order=0)]
public DataSet GetLocInfoResult;
public GetLocInfoResponse()
{
}
public GetLocInfoResponse(DataSet GetLocInfoResult, string locationCode)
{
this.GetLocInfoResult = GetLocInfoResult;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public partial class WcfServiceClient : Microsoft.Tools.ServiceModel.CFClientBase<IWcfService>, IWcfService
{
public static System.ServiceModel.EndpointAddress EndpointAddress = new System.ServiceModel.EndpointAddress("http://localhost/WcfService");
public WcfServiceClient() : this(CreateDefaultBinding(), EndpointAddress)
{
}
public WcfServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
addProtectionRequirements(binding);
}
private GetHelloResponse GetHello(GetHelloRequest request)
{
CFInvokeInfo info = new CFInvokeInfo();
info.Action = "http://tempuri.org/IWcfService/GetHello";
info.RequestIsWrapped = true;
info.ReplyAction = "http://tempuri.org/IWcfService/GetHelloResponse";
info.ResponseIsWrapped = true;
GetHelloResponse retVal = base.Invoke<GetHelloRequest, GetHelloResponse>(info, request);
return retVal;
}
public string GetHello()
{
GetHelloRequest request = new GetHelloRequest();
GetHelloResponse response = this.GetHello(request);
return response.GetHelloResult;
}
private GetLocInfoResponse GetLocInfo(GetLocInfoRequest request, string locationCode)
{
CFInvokeInfo info = new CFInvokeInfo();
info.Action = "http://tempuri.org/IWcfService/GetLocInfo";
info.RequestIsWrapped = true;
info.ReplyAction = "http://tempuri.org/IWcfService/GetLocInfoResponse";
info.ResponseIsWrapped = true;
GetLocInfoResponse retVal = base.Invoke<GetLocInfoRequest, GetLocInfoResponse>(info, request);
return retVal;
}
public DataSet GetLocInfo(string locationCode)
{
GetLocInfoRequest request = new GetLocInfoRequest(locationCode);
GetLocInfoResponse response = this.GetLocInfo(request, locationCode);
return response.GetLocInfoResult;
}
public static System.ServiceModel.Channels.Binding CreateDefaultBinding()
{
System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding();
binding.Elements.Add(new System.ServiceModel.Channels.TextMessageEncodingBindingElement(System.ServiceModel.Channels.MessageVersion.Soap11, System.Text.Encoding.UTF8));
binding.Elements.Add(new System.ServiceModel.Channels.HttpTransportBindingElement());
return binding;
}
private void addProtectionRequirements(System.ServiceModel.Channels.Binding binding)
{
if (IsSecureMessageBinding(binding) == false)
{
return;
}
System.ServiceModel.Security.ChannelProtectionRequirements cpr = new System.ServiceModel.Security.ChannelProtectionRequirements();
ApplyProtection("http://tempuri.org/IWcfService/GetHello", cpr.IncomingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetHello", cpr.IncomingEncryptionParts, true);
if ((binding.MessageVersion.Addressing == System.ServiceModel.Channels.AddressingVersion.None))
{
ApplyProtection("*", cpr.OutgoingSignatureParts, true);
ApplyProtection("*", cpr.OutgoingEncryptionParts, true);
}
else
{
ApplyProtection("http://tempuri.org/IWcfService/GetHelloResponse", cpr.OutgoingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetHelloResponse", cpr.OutgoingEncryptionParts, true);
}
this.Parameters.Add(cpr);
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfo", cpr.IncomingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfo", cpr.IncomingEncryptionParts, true);
if ((binding.MessageVersion.Addressing == System.ServiceModel.Channels.AddressingVersion.None))
{
ApplyProtection("*", cpr.OutgoingSignatureParts, true);
ApplyProtection("*", cpr.OutgoingEncryptionParts, true);
}
else
{
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfoResponse", cpr.OutgoingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfoResponse", cpr.OutgoingEncryptionParts, true);
}
this.Parameters.Add(cpr);
}
}
using System.Data;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public interface IWcfService
{
string GetHello();
DataSet GetLocInfo(string locationCode);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName = "GetHello", Namespace = "http://tempuri.org/")]
public partial class GetHelloRequest
{
public GetHelloRequest()
{
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName = "GetLocInfo", Namespace = "http://tempuri.org/")]
public partial class GetLocInfoRequest
{
public string locationCode;
public GetLocInfoRequest()
{
}
public GetLocInfoRequest(string locationCode)
{
this.locationCode = locationCode;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName = "GetHelloResponse", Namespace = "http://tempuri.org/")]
public partial class GetHelloResponse
{
[System.Xml.Serialization.XmlElementAttribute(IsNullable = true, Namespace = "http://tempuri.org/", Order = 0)]
public string GetHelloResult;
public GetHelloResponse()
{
}
public GetHelloResponse(string GetHelloResult)
{
this.GetHelloResult = GetHelloResult;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.Xml.Serialization.XmlRootAttribute(ElementName = "GetLocInfoResponse", Namespace = "http://tempuri.org/")]
public partial class GetLocInfoResponse
{
[System.Xml.Serialization.XmlElementAttribute(IsNullable = true, Namespace = "http://tempuri.org/", Order = 0)]
public DataSet GetLocInfoResult;
public GetLocInfoResponse()
{
}
public GetLocInfoResponse(DataSet GetLocInfoResult, string locationCode)
{
this.GetLocInfoResult = GetLocInfoResult;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public partial class WcfServiceClient : Microsoft.Tools.ServiceModel.CFClientBase<IWcfService>, IWcfService
{
public static System.ServiceModel.EndpointAddress EndpointAddress = new System.ServiceModel.EndpointAddress("http://localhost/WcfService");
public WcfServiceClient()
: this(CreateDefaultBinding(), EndpointAddress)
{
}
public WcfServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
addProtectionRequirements(binding);
}
private GetHelloResponse GetHello(GetHelloRequest request)
{
CFInvokeInfo info = new CFInvokeInfo();
info.Action = "http://tempuri.org/IWcfService/GetHello";
info.RequestIsWrapped = true;
info.ReplyAction = "http://tempuri.org/IWcfService/GetHelloResponse";
info.ResponseIsWrapped = true;
GetHelloResponse retVal = base.Invoke<GetHelloRequest, GetHelloResponse>(info, request);
return retVal;
}
public string GetHello()
{
GetHelloRequest request = new GetHelloRequest();
GetHelloResponse response = this.GetHello(request);
return response.GetHelloResult;
}
private GetLocInfoResponse GetLocInfo(GetLocInfoRequest request, string locationCode)
{
CFInvokeInfo info = new CFInvokeInfo();
info.Action = "http://tempuri.org/IWcfService/GetLocInfo";
info.RequestIsWrapped = true;
info.ReplyAction = "http://tempuri.org/IWcfService/GetLocInfoResponse";
info.ResponseIsWrapped = true;
GetLocInfoResponse retVal = base.Invoke<GetLocInfoRequest, GetLocInfoResponse>(info, request);
return retVal;
}
public DataSet GetLocInfo(string locationCode)
{
GetLocInfoRequest request = new GetLocInfoRequest(locationCode);
GetLocInfoResponse response = this.GetLocInfo(request, locationCode);
return response.GetLocInfoResult;
}
public static System.ServiceModel.Channels.Binding CreateDefaultBinding()
{
System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding();
binding.Elements.Add(new System.ServiceModel.Channels.TextMessageEncodingBindingElement(System.ServiceModel.Channels.MessageVersion.Soap11, System.Text.Encoding.UTF8));
binding.Elements.Add(new System.ServiceModel.Channels.HttpTransportBindingElement());
return binding;
}
private void addProtectionRequirements(System.ServiceModel.Channels.Binding binding)
{
if (IsSecureMessageBinding(binding) == false)
{
return;
}
System.ServiceModel.Security.ChannelProtectionRequirements cpr = new System.ServiceModel.Security.ChannelProtectionRequirements();
ApplyProtection("http://tempuri.org/IWcfService/GetHello", cpr.IncomingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetHello", cpr.IncomingEncryptionParts, true);
if ((binding.MessageVersion.Addressing == System.ServiceModel.Channels.AddressingVersion.None))
{
ApplyProtection("*", cpr.OutgoingSignatureParts, true);
ApplyProtection("*", cpr.OutgoingEncryptionParts, true);
}
else
{
ApplyProtection("http://tempuri.org/IWcfService/GetHelloResponse", cpr.OutgoingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetHelloResponse", cpr.OutgoingEncryptionParts, true);
}
this.Parameters.Add(cpr);
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfo", cpr.IncomingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfo", cpr.IncomingEncryptionParts, true);
if ((binding.MessageVersion.Addressing == System.ServiceModel.Channels.AddressingVersion.None))
{
ApplyProtection("*", cpr.OutgoingSignatureParts, true);
ApplyProtection("*", cpr.OutgoingEncryptionParts, true);
}
else
{
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfoResponse", cpr.OutgoingSignatureParts, true);
ApplyProtection("http://tempuri.org/IWcfService/GetLocInfoResponse", cpr.OutgoingEncryptionParts, true);
}
this.Parameters.Add(cpr);
}
}