Asp.net mvc 如何从XSD和WSDL文件创建Web服务?

Asp.net mvc 如何从XSD和WSDL文件创建Web服务?,asp.net-mvc,web-services,soap,xsd,wsdl,Asp.net Mvc,Web Services,Soap,Xsd,Wsdl,问题是: 我有一个.WSDL文件和一个.XSD文件,我需要创建一个web服务来整合到解决方案中。 我做的第一件事是创建一个新的project=>WCF=>WCF服务应用程序 之后,我知道我需要一些类来创建围绕它的web服务,所以我尝试了不同的方法来从WSDL和XSD文件生成它们,但没有成功 我试过几种方法: 1:xsd/c myFile.xsd/n:mynamespace 但给了我几个错误: 架构验证警告:类型属性不能与simpleType或complexType一起出现。 卡贝萨略 数据/时

问题是: 我有一个.WSDL文件和一个.XSD文件,我需要创建一个web服务来整合到解决方案中。 我做的第一件事是创建一个新的project=>WCF=>WCF服务应用程序 之后,我知道我需要一些类来创建围绕它的web服务,所以我尝试了不同的方法来从WSDL和XSD文件生成它们,但没有成功

我试过几种方法:

1:
xsd/c myFile.xsd/n:mynamespace

但给了我几个错误:

架构验证警告:类型属性不能与simpleType或complexType一起出现。


卡贝萨略
数据/时间
维斯朗
2:
svcutil.exe/language:C#/out:myService.cs/n:*,mynamespace myFile.wsdl

如果我尝试使用这种方法,也会给我带来很多错误

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: The type attribute cannot be present with either simpleType or complexType.
XPath to Error Source: //wsdl:definitions[@targetNamespace='myurl.pt/myservice/service']/wsdl:portType[@name='ELServiceSoap']


Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='myurl.pt/myservice/service']/wsdl:portType[@name='ELServiceSoap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='myurl.pt/myservice/service']/wsdl:binding[@name='ELServiceSoap']


Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='myurl.pt/myservice/service']/wsdl:binding[@name='ELServiceSoap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='myurl.pt/myservice/service']/wsdl:service[@name='ELService']/wsdl:port[@name='ELServiceSoap']


Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.
即使我将命令与/dataContractOnly选项一起使用,它也会返回到xsd命令中的错误:

Error: An error occurred in the tool.

Error: The type attribute cannot be present with either simpleType or complexType.
我不确定我是否朝着正确的方向去创建Web服务,但是如果是,我如何解决这个错误呢