for a web service, depending on a XML file, there are a couple af classes in C# generated. Depending on these classes, there is at compile time then the WSDL file generated. Is there a possibility at runtime to simply replace the XML file and to have the WSDL file generated on the fly?
对于Web服务,根据XML文件,在C#中生成了几个af类。根据这些类,在编译时生成WSDL文件。是否有可能在运行时简单地替换XML文件并动态生成WSDL文件?
Best regards, Valer
此致,Valer
2 个解决方案
#1
I thought the WSDL was generated on the fly when you did Service.asmx?wsdl or somesuch?
我认为当您执行Service.asmx?wsdl或某些事情时,WSDL是在动态生成的?
#2
That would be inadvisable, and really doesn't make a lot of sense in the context of a compiled application.
这是不可取的,在编译应用程序的上下文中确实没有多大意义。
The WSDL is an XML-formatted version of the interface of a class. This interface is fixed at compile time. In order for the WSDL to change, the class interface would have to change, which can't (or, at the very least, shouldn't - anything is possible) happen at run time.
WSDL是类的接口的XML格式版本。此接口在编译时是固定的。为了改变WSDL,类接口必须改变,在运行时不能(或者,至少,不应该 - 任何可能的东西)发生。
If you're worried about generating the WSDL for a service you're consuming, rather than producing, then the same problem applies. An updated WSDL could, say, rename all of the methods by giving them a prefix, like, "fu_Update()" where your app expects "Update()," in which case any code that referenced that service would break.
如果您担心为正在使用的服务生成WSDL而不是生成,那么同样的问题也适用。更新的WSDL可以,比方说,给他们一个前缀命名所有的方法一样,“fu_Update()”,其中您的应用希望“更新()”,在这种情况下引用该服务将打破任何代码。
Interpreted languages will probably let you do this, but it's of little or no benefit, since just about anytime the WSDL changes, the code that uses it will have to change, as well.
解释性语言可能会让你这样做,但它几乎没有任何好处,因为几乎在WSDL发生变化的任何时候,使用它的代码也必须改变。
#1
I thought the WSDL was generated on the fly when you did Service.asmx?wsdl or somesuch?
我认为当您执行Service.asmx?wsdl或某些事情时,WSDL是在动态生成的?
#2
That would be inadvisable, and really doesn't make a lot of sense in the context of a compiled application.
这是不可取的,在编译应用程序的上下文中确实没有多大意义。
The WSDL is an XML-formatted version of the interface of a class. This interface is fixed at compile time. In order for the WSDL to change, the class interface would have to change, which can't (or, at the very least, shouldn't - anything is possible) happen at run time.
WSDL是类的接口的XML格式版本。此接口在编译时是固定的。为了改变WSDL,类接口必须改变,在运行时不能(或者,至少,不应该 - 任何可能的东西)发生。
If you're worried about generating the WSDL for a service you're consuming, rather than producing, then the same problem applies. An updated WSDL could, say, rename all of the methods by giving them a prefix, like, "fu_Update()" where your app expects "Update()," in which case any code that referenced that service would break.
如果您担心为正在使用的服务生成WSDL而不是生成,那么同样的问题也适用。更新的WSDL可以,比方说,给他们一个前缀命名所有的方法一样,“fu_Update()”,其中您的应用希望“更新()”,在这种情况下引用该服务将打破任何代码。
Interpreted languages will probably let you do this, but it's of little or no benefit, since just about anytime the WSDL changes, the code that uses it will have to change, as well.
解释性语言可能会让你这样做,但它几乎没有任何好处,因为几乎在WSDL发生变化的任何时候,使用它的代码也必须改变。