本文整理汇总了C#中System.ServiceModel.Description.WsdlExporter.ExportEndpoint方法的典型用法代码示例。如果您正苦于以下问题:C# WsdlExporter.ExportEndpoint方法的具体用法?C# WsdlExporter.ExportEndpoint怎么用?C# WsdlExporter.ExportEndpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Description.WsdlExporter
的用法示例。
在下文中一共展示了WsdlExporter.ExportEndpoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportEndpointTest
public void ExportEndpointTest ()
{
WsdlExporter we = new WsdlExporter ();
ServiceEndpoint se = new ServiceEndpoint (ContractDescription.GetContract (typeof (IEchoService)));
se.Binding = new BasicHttpBinding ();
se.Address = new EndpointAddress ("http://localhost:8080");
//TEST Invalid name: 5se.Name = "Service#1";
//se.Name = "Service0";
//se.ListenUri = new Uri ("http://localhost:8080/svc");
we.ExportEndpoint (se);
MetadataSet ms = we.GetGeneratedMetadata ();
Assert.AreEqual (6, ms.MetadataSections.Count);
CheckContract_IEchoService (ms, "#eet01");
WSServiceDescription sd = GetServiceDescription (ms, "http://tempuri.org/", "ExportEndpointTest");
CheckServicePort (GetService (sd, "service", "ExportEndpointTest"),
"BasicHttpBinding_IEchoService", new XmlQualifiedName ("BasicHttpBinding_IEchoService", "http://tempuri.org/"),
"http://localhost:8080/", "#eet02");
CheckBasicHttpBinding (sd, "BasicHttpBinding_IEchoService", new XmlQualifiedName ("IEchoService", "http://myns/echo"),
"Echo", "http://myns/echo/IEchoService/Echo", true, true, "#eet03");
}
示例2: ExportEndpoints
private XmlDocument ExportEndpoints()
{
WsdlExporter exporter = new WsdlExporter();
foreach (ServiceEndpoint ep in endpoints)
{
exporter.ExportEndpoint(ep);
}
MetadataSet metadataSet = exporter.GetGeneratedMetadata();
StringBuilder b = new StringBuilder();
StringWriter sw = new StringWriter(b);
XmlTextWriter tw = new XmlTextWriter(sw);
foreach (MetadataSection section in metadataSet.MetadataSections)
{
if (section.Metadata is System.Web.Services.Description.ServiceDescription)
{
System.Web.Services.Description.ServiceDescription sd = (System.Web.Services.Description.ServiceDescription)section.Metadata;
sd.Write(tw);
}
}
string wcfWsdl = b.ToString();
// Read it in to an XmlDocument.
XmlDocument wcfWsdlDoc = new XmlDocument();
wcfWsdlDoc.LoadXml(wcfWsdl);
return wcfWsdlDoc;
}
示例3: WsdlExporter
void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
WsdlExporter wsdlExporter = new WsdlExporter();
wsdlExporter.ExportEndpoint(endpoint);
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(
new XsdValidationInspector(wsdlExporter.GeneratedXmlSchemas));
}
示例4: BasicHttp
public static MetadataSet BasicHttp ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
exporter.ExportEndpoint (new ServiceEndpoint (
cd, new BasicHttpBinding (), new EndpointAddress (HttpUri)));
return exporter.GetGeneratedMetadata ();
}
示例5: BasicHttp_TransportSecurity
public static MetadataSet BasicHttp_TransportSecurity ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
var binding = new BasicHttpBinding ();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (HttpUri)));
return exporter.GetGeneratedMetadata ();
}
示例6: BasicHttp_MessageSecurity
public static MetadataSet BasicHttp_MessageSecurity ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
var binding = new BasicHttpBinding ();
binding.Security.Mode = BasicHttpSecurityMode.Message;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (HttpUri)));
return exporter.GetGeneratedMetadata ();
}
示例7: SimpleExport
public void SimpleExport ()
{
var label = new TestLabel ("DuplicateContract");
var cd = new ContractDescription ("MyContract");
var endpoint = new ServiceEndpoint (
cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
var exporter = new WsdlExporter ();
exporter.ExportContract (cd);
exporter.ExportEndpoint (endpoint);
CheckExport (
exporter, new QName ("MyContract", "http://tempuri.org/"),
"BasicHttpBinding", 1, label);
}
示例8: ExportEndpointTest5
public void ExportEndpointTest5 () {
WsdlExporter we = new WsdlExporter ();
ServiceEndpoint se = new ServiceEndpoint (ContractDescription.GetContract (typeof (IEchoService)));
se.Binding = new BasicHttpBinding ();
se.Address = new EndpointAddress ("http://localhost:8080");
we.ExportEndpoint (se);
MetadataSet ms = we.GetGeneratedMetadata ();
Assert.AreEqual (6, ms.MetadataSections.Count);
WSServiceDescription wsd = GetServiceDescription (ms, "http://tempuri.org/", "ExportEndpointTest5#1");
SoapBinding soapBinding = (SoapBinding) wsd.Bindings [0].Extensions [0];
Assert.AreEqual (SoapBindingStyle.Document, soapBinding.Style, "soapBinding.Style");
Assert.AreEqual (SoapBinding.HttpTransport, soapBinding.Transport, "soapBinding.Transport");
}
示例9: NetTcp_TransferMode
public static MetadataSet NetTcp_TransferMode ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
var binding = new NetTcpBinding (SecurityMode.None, false);
binding.TransferMode = TransferMode.Streamed;
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (NetTcpUri)));
var doc = exporter.GetGeneratedMetadata ();
return doc;
}
示例10: NetTcp_ReliableSession
public static MetadataSet NetTcp_ReliableSession ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
var binding = new NetTcpBinding (SecurityMode.None, true);
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (NetTcpUri)));
var doc = exporter.GetGeneratedMetadata ();
return doc;
}
示例11: NetTcp_TransportWithMessageCredential
public static MetadataSet NetTcp_TransportWithMessageCredential ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
exporter.ExportEndpoint (new ServiceEndpoint (
cd, new NetTcpBinding (SecurityMode.TransportWithMessageCredential, false),
new EndpointAddress (NetTcpUri)));
var doc = exporter.GetGeneratedMetadata ();
return doc;
}
示例12: BasicHttps_TransportWithMessageCredential
public static MetadataSet BasicHttps_TransportWithMessageCredential ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
var binding = new BasicHttpsBinding (BasicHttpsSecurityMode.TransportWithMessageCredential);
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (HttpsUri)));
var doc = exporter.GetGeneratedMetadata ();
return doc;
}
示例13: BasicHttp_Config
public static MetadataSet BasicHttp_Config ()
{
var exporter = new WsdlExporter ();
var cd = ContractDescription.GetContract (typeof (IMyContract));
var binding = new BasicHttpBinding ();
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (HttpUri)));
return exporter.GetGeneratedMetadata ();
}
示例14: Main
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(WcfServiceLibrary1.Service1)))
{
// surrogate definition..
foreach (ServiceEndpoint ep in host.Description.Endpoints)
{
foreach (OperationDescription op in ep.Contract.Operations)
{
DataContractSerializerOperationBehavior dataContractBehavior =
op.Behaviors.Find<DataContractSerializerOperationBehavior>()
as DataContractSerializerOperationBehavior;
if (dataContractBehavior != null)
{
dataContractBehavior.DataContractSurrogate = new valToTransferAsBytes();
}
else
{
dataContractBehavior = new DataContractSerializerOperationBehavior(op);
dataContractBehavior.DataContractSurrogate = new valToTransferAsBytes();
op.Behaviors.Add(dataContractBehavior);
}
}
}
// set up exporter with surrogate definition..
WsdlExporter exporter = new WsdlExporter();
object dataContractExporter;
XsdDataContractExporter xsdInventoryExporter;
if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter),
out dataContractExporter))
{
xsdInventoryExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas);
}
else
xsdInventoryExporter = (XsdDataContractExporter)dataContractExporter;
exporter.State.Add(typeof(XsdDataContractExporter), xsdInventoryExporter);
if (xsdInventoryExporter.Options == null)
xsdInventoryExporter.Options = new ExportOptions();
xsdInventoryExporter.Options.DataContractSurrogate = new valToTransferAsBytes();
// export the endpoints..
ServiceEndpointCollection sec = host.Description.Endpoints;
foreach (ServiceEndpoint se in sec)
{
Console.WriteLine(se.Name);
exporter.ExportEndpoint(se);
}
MetadataSet docs = null;
docs = exporter.GetGeneratedMetadata();
host.Description.
host.Open();
PrintDescription(host);
Console.WriteLine("The Trading Service is available. Press any key to exit.");
Console.ReadKey();
host.Close();
}
}
示例15: BasicHttp_Mtom
public static MetadataSet BasicHttp_Mtom ()
{
var exporter = new WsdlExporter ();
var cd = new ContractDescription ("MyContract");
var binding = new BasicHttpBinding ();
binding.MessageEncoding = WSMessageEncoding.Mtom;
exporter.ExportEndpoint (new ServiceEndpoint (
cd, binding, new EndpointAddress (HttpUri)));
var doc = exporter.GetGeneratedMetadata ();
return doc;
}