Adobe Flex Builder WSDL 类自动生成器生成奇怪的文件

发布于 2024-08-01 16:22:40 字数 4067 浏览 12 评论 0原文

Adobe Flex Builder WSDL 类自动生成器生成奇怪的文件。

例如:

http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl

导入后会生成以下文件:

ArrayOfForecast.as
ArrayOfWeatherDescription.as
ArrayOfWeatherDescription0.as
BaseWeather.as
BaseWeatherSchema.as
Forecast.as
ForecastReturn.as
ForecastReturn0.as
GetCityForecastByZIPResultEvent.as
GetCityForecastByZIP_request.as
GetCityWeatherByZIPResultEvent.as
GetCityWeatherByZIP_request.as
GetWeatherInformationResultEvent.as
GetWeatherInformation_request.as
IWeather.as
POP.as
Temp.as
Weather.as
WeatherDescription.as
WeatherReturn.as
WeatherReturn0.as

文件末尾的这些 0 是做什么用的?

这是包含 3 次操作的服务示例。 我真正的 wsdl 有更多的方法和类型。

已更新

同时,Java 生成了更清晰的类集:

Forecast.java
ForecastReturn.java
POP.java
Temp.java
WeatherDescription.java
Weather.java
WeatherLocator.java
WeatherReturn.java
WeatherSoap12Stub.java
WeatherSoap.java
WeatherSoapProxy.java
WeatherSoapStub.java

对于如此小的服务来说,这一点并不明显,但对于具有更多操作和类型的较大服务,它会生成数百个类。 我怀疑 Adob​​e Flex 团队是否以正确的方式自动生成 wsdl 类。

UPDATE-2

WeatherReturn.as:

 public class WeatherReturn
 {
  /**
   * Constructor, initializes the type class
   */
  public function WeatherReturn() {}

  public var Success:Boolean;
  public var ResponseText:String;
  public var State:String;
  public var City:String;
  public var WeatherStationCity:String;
  public var WeatherID:Number;
  public var Description:String;
  public var Temperature:String;
  public var RelativeHumidity:String;
  public var Wind:String;
  public var Pressure:String;
  public var Visibility:String;
  public var WindChill:String;
  public var Remarks:String;
 }

WeatherReturn0.as:

 public class WeatherReturn0
 {
  /**
   * Constructor, initializes the type class
   */
  public function WeatherReturn0() {}

  public var WeatherReturn:com.cdyne.WeatherReturn;
 }

WeatherReturn.java:

public class WeatherReturn  implements java.io.Serializable {
    private boolean success;
    private java.lang.String responseText;
    private java.lang.String state;
    private java.lang.String city;
    private java.lang.String weatherStationCity;
    private short weatherID;
    private java.lang.String description;
    private java.lang.String temperature;
    private java.lang.String relativeHumidity;
    private java.lang.String wind;
    private java.lang.String pressure;
    private java.lang.String visibility;
    private java.lang.String windChill;
    private java.lang.String remarks;

// Skipped constructors and getter/setter

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj)

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode()

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =  new org.apache.axis.description.TypeDesc(WeatherReturn.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://ws.cdyne.com/WeatherWS/", "WeatherReturn"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("success");
        elemField.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com/WeatherWS/", "Success"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("responseText");
 // More typedesc here ...
    }

    public static org.apache.axis.description.TypeDesc getTypeDesc() {
    public static org.apache.axis.encoding.Serializer getSerializer(
    public static org.apache.axis.encoding.Deserializer getDeserializer(
}

我只留下了 Java 的方法签名示例并跳过 getter/setter。

Adobe Flex Builder WSDL classes autogenerator generates wierd files.

For example:

http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl

After importing it generates these files:

ArrayOfForecast.as
ArrayOfWeatherDescription.as
ArrayOfWeatherDescription0.as
BaseWeather.as
BaseWeatherSchema.as
Forecast.as
ForecastReturn.as
ForecastReturn0.as
GetCityForecastByZIPResultEvent.as
GetCityForecastByZIP_request.as
GetCityWeatherByZIPResultEvent.as
GetCityWeatherByZIP_request.as
GetWeatherInformationResultEvent.as
GetWeatherInformation_request.as
IWeather.as
POP.as
Temp.as
Weather.as
WeatherDescription.as
WeatherReturn.as
WeatherReturn0.as

What are these ZERO at the end files for?

That was an example for service with 3 operations. My real wsdl has much more methods and types.

UPDATED

At the same time Java generates much cleaner set of classes:

Forecast.java
ForecastReturn.java
POP.java
Temp.java
WeatherDescription.java
Weather.java
WeatherLocator.java
WeatherReturn.java
WeatherSoap12Stub.java
WeatherSoap.java
WeatherSoapProxy.java
WeatherSoapStub.java

It's not noticeable for such small service, but for bigger service with more operations and types it generates hundreds of classes. I have doubt that Adobe Flex team does wsdl classes autogeneration in proper way.

UPDATE-2

WeatherReturn.as:

 public class WeatherReturn
 {
  /**
   * Constructor, initializes the type class
   */
  public function WeatherReturn() {}

  public var Success:Boolean;
  public var ResponseText:String;
  public var State:String;
  public var City:String;
  public var WeatherStationCity:String;
  public var WeatherID:Number;
  public var Description:String;
  public var Temperature:String;
  public var RelativeHumidity:String;
  public var Wind:String;
  public var Pressure:String;
  public var Visibility:String;
  public var WindChill:String;
  public var Remarks:String;
 }

WeatherReturn0.as:

 public class WeatherReturn0
 {
  /**
   * Constructor, initializes the type class
   */
  public function WeatherReturn0() {}

  public var WeatherReturn:com.cdyne.WeatherReturn;
 }

WeatherReturn.java:

public class WeatherReturn  implements java.io.Serializable {
    private boolean success;
    private java.lang.String responseText;
    private java.lang.String state;
    private java.lang.String city;
    private java.lang.String weatherStationCity;
    private short weatherID;
    private java.lang.String description;
    private java.lang.String temperature;
    private java.lang.String relativeHumidity;
    private java.lang.String wind;
    private java.lang.String pressure;
    private java.lang.String visibility;
    private java.lang.String windChill;
    private java.lang.String remarks;

// Skipped constructors and getter/setter

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj)

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode()

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =  new org.apache.axis.description.TypeDesc(WeatherReturn.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://ws.cdyne.com/WeatherWS/", "WeatherReturn"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("success");
        elemField.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com/WeatherWS/", "Success"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("responseText");
 // More typedesc here ...
    }

    public static org.apache.axis.description.TypeDesc getTypeDesc() {
    public static org.apache.axis.encoding.Serializer getSerializer(
    public static org.apache.axis.encoding.Deserializer getDeserializer(
}

I left only methods signatures for Java example and skipped getters/setters.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文