WCF:如何在WSDL文件的定义部分编写属性?

时间:2012-09-19 06:57:15

标签: wcf wsdl asmx

我正在尝试从头开始以编程方式生成WSDL文件,它几乎正常工作。我不知道该怎么做的一点是在定义部分编写我自己的属性。我的意思是在WSDL文件的这一部分:

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"...>

我使用以下C#代码:

System.Web.Services.Description.ServiceDescription wsdl = new System.Web.Services.Description.ServiceDescription();

System.Xml.Schema.XmlSchema xmlSchema = new System.Xml.Schema.XmlSchema();
xmlSchema.SourceUri = "PO.xsd";
System.Xml.Schema.XmlSchemaImport xmlSchemaImport = new System.Xml.Schema.XmlSchemaImport();
xmlSchemaImport.Namespace = "http://tempuri.org/PO";
xmlSchemaImport.SchemaLocation = "PO.xsd";
xmlSchema.Includes.Add(xmlSchemaImport);
wsdl.Types.Schemas.Add(xmlSchema);

...

wsdl.Write("POService.wsdl");

它发生了什么?定义部分中的属性由代码自动生成,但我需要在那里添加一些自定义构造。

有人知道怎么做吗?

提前谢谢。

戈兰

0 个答案:

没有答案