我使用 Visual Studio 的 WSDL 实用程序从 WSDL 生成 JavaScript 类。
wsdl /o:SomeClasses.js /l:js https://SomeCompany.com/SomeService?WSDL
输出包含如下所示的类(在 JavaScript 中):
public System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1") System.SerializableAttribute() System.Diagnostics.DebuggerStepThroughAttribute() System.ComponentModel.DesignerCategoryAttribute("code") System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:some.company")
class SomeUser {
private var domainNameField : System.String;
private var userNameField : System.String;
///<remarks/>
public final function get domainName() : System.String {
return this.domainNameField;
}
public final function set domainName(value : System.String) {
this.domainNameField = value;
}
///<remarks/>
public final function get userName() : System.String {
return this.userNameField;
}
public final function set userName(value : System.String) {
this.userNameField = value;
}
}
是否可以使用这些类编写 OOP JavaScript?如果是这样,语法,示例等是什么?