我正在尝试从头开始以编程方式生成 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");
它会发生什么?定义部分中的属性是由代码自动生成的,但我需要在那里添加一些自定义结构。
有人知道该怎么做吗?
先感谢您。
戈兰