本文整理汇总了C#中System.ServiceModel.Description.WsdlExporter类的典型用法代码示例。如果您正苦于以下问题:C# WsdlExporter类的具体用法?C# WsdlExporter怎么用?C# WsdlExporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WsdlExporter类属于System.ServiceModel.Description命名空间,在下文中一共展示了WsdlExporter类的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: WsdlExporter
void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
WsdlExporter wsdlExporter = new WsdlExporter();
wsdlExporter.ExportEndpoint(endpoint);
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(
new XsdValidationInspector(wsdlExporter.GeneratedXmlSchemas));
}
示例3: MessageContractExporter
protected MessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension)
{
this.exporter = exporter;
this.contractContext = context;
this.operation = operation;
this.extension = extension;
}
示例4: 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;
}
示例5: ExportEndpoint
public void ExportEndpoint(
WsdlExporter exporter,
WsdlEndpointConversionContext context
)
{
}
示例6: ExportContract
//
// IWsdlExportExtension Implementation
//
public void ExportContract(
WsdlExporter exporter,
WsdlContractConversionContext context
)
{
// never called
}
示例7: foreach
/// <summary>
/// When ExportContract is called to generate the necessary metadata, we inspect the service
/// contract and build a list of parameters that we'll need to adjust the XSD for later.
/// </summary>
void IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
{
_requiredParameter = new List<RequiredMessagePart>();
foreach (var operation in context.Contract.Operations)
{
var inputMessage = operation.Messages.Where(m => m.Direction == MessageDirection.Input).First();
var parameters = operation.SyncMethod.GetParameters();
Debug.Assert(parameters.Length == inputMessage.Body.Parts.Count);
for (int i = 0; i < parameters.Length; i++)
{
object[] attributes = parameters[i].GetCustomAttributes(typeof(OptionalAttribute), false);
if (attributes.Length == 0)
{
// The parameter has no [Optional] attribute, add it to the list of parameters
// that we need to adjust the XML schema for later on.
_requiredParameter.Add(new RequiredMessagePart()
{
Namespace = inputMessage.Body.Parts[i].Namespace,
Message = operation.Name,
Name = inputMessage.Body.Parts[i].Name
});
}
}
}
}
示例8:
void IWsdlExportExtension.ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context)
{
if (SingleFile)
SingleFileExporter.ExportEndpoint(exporter);
if (Location != null)
{
LocationOverrideExporter.ExportEndpoint(exporter, context, Location);
}
}
示例9: GetMessageExportContext
static MessageExportContext GetMessageExportContext(WsdlExporter exporter)
{
object messageExportContext;
if (!exporter.State.TryGetValue(typeof(MessageExportContext), out messageExportContext))
{
messageExportContext = new MessageExportContext();
exporter.State[typeof(MessageExportContext)] = messageExportContext;
}
return (MessageExportContext)messageExportContext;
}
示例10: 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 ();
}
示例11: Ctor1
public void Ctor1 ()
{
WsdlExporter we = new WsdlExporter ();
Assert.IsNotNull (we.GetGeneratedMetadata ());
Assert.IsNotNull (we.GeneratedWsdlDocuments, "#c1");
Assert.AreEqual (0, we.GeneratedWsdlDocuments.Count, "#c2");
Assert.IsNotNull (we.GeneratedXmlSchemas, "#c3");
Assert.AreEqual (0, we.GeneratedXmlSchemas.Count, "#c4");
}
示例12: Generate
public static Wsdl Generate(Type contract)
{
var exporter = new WsdlExporter();
exporter.ExportContract(ContractDescription.GetContract(contract));
var metadataSet = exporter.GetGeneratedMetadata();
var schemaStream = new MemoryStream();
metadataSet.WriteTo(new XmlTextWriter(new StreamWriter(schemaStream)));
schemaStream.Position = 0;
var source = XDocument.Load(
new XmlTextReader(schemaStream));
return new Wsdl(source);
}
示例13: Trace
public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, System.ServiceModel.Description.ServiceDescription service)
{
if (DiagnosticUtility.ShouldTrace(type))
{
WsdlExporter exporter = new WsdlExporter();
string ns = "http://tempuri.org/";
XmlQualifiedName wsdlServiceQName = new XmlQualifiedName("comPlusService", ns);
exporter.ExportEndpoints(service.Endpoints, wsdlServiceQName);
System.Web.Services.Description.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[ns];
ComPlusServiceHostStartedServiceDetailsSchema schema = new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
}
}
示例14: 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 ();
}
示例15: Trace
public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceDescription service)
{
if (DiagnosticUtility.ShouldTrace(type))
{
WsdlExporter exporter = new WsdlExporter();
string serviceNs = NamingHelper.DefaultNamespace;
XmlQualifiedName serviceQName = new XmlQualifiedName("comPlusService", serviceNs);
exporter.ExportEndpoints(service.Endpoints, serviceQName);
WsdlNS.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[serviceNs];
ComPlusServiceHostStartedServiceDetailsSchema record =
new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
}
}