Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » API class changed by WS Client code generation
API class changed by WS Client code generation [message #554802] Tue, 24 August 2010 12:42 Go to next message
Marcin Choinski is currently offline Marcin ChoinskiFriend
Messages: 2
Registered: August 2010
Junior Member
Hi!

I'm pretty new to WTP and WS so forgive me any stupid mistakes...

I have a following problem:

I created a Dynamic Web project and created a class, that is using some other class as an input attribute.

The input class looks as follows:
package pl.edu.ola.OLASimpleDMAPIWEKAImpl.core;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import pl.edu.ola.OLASimpleDMAPI.core.DataSet;

public class DataSetWEKAImpl implements DataSet {
	
	private String arffDataSetLocation;
	private byte [] arffDataSet;
	
	public DataSetWEKAImpl(){}
	
	public DataSetWEKAImpl(String arffDataSetLocation) {
		this.arffDataSetLocation = arffDataSetLocation;
		try {
			arffDataSet = getFileAsBytes(new File(arffDataSetLocation));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public String getDataSetLocation() {
		return arffDataSetLocation;
	}
	
	private byte[] getFileAsBytes(File file) throws IOException {
		BufferedInputStream bis = new BufferedInputStream( 
			new FileInputStream(file));
		byte [] bytes = new byte[(int) file.length()];
		bis.read(bytes);
		bis.close();
		return bytes;
	}

	@Override
	public byte [] getDataSetAsByteArray() {
		return arffDataSet;
	}

}



As you can see, it has two private fields and one (byte array) is filled by the class constructor taking String as an attribute.

The Client generated by WTP (using Axis, not Axis2) recreates the mentioned class with different constructor!

Below is the generated code:
/**
 * DataSetWEKAImpl.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package pl.edu.ola.OLASimpleDMAPIWEKAImpl.core;

public class DataSetWEKAImpl  implements java.io.Serializable {
    private byte[] dataSetAsByteArray;

    private java.lang.String dataSetLocation;

    public DataSetWEKAImpl() {
    }

    public DataSetWEKAImpl(
           byte[] dataSetAsByteArray,
           java.lang.String dataSetLocation) {
           this.dataSetAsByteArray = dataSetAsByteArray;
           this.dataSetLocation = dataSetLocation;
    }


    /**
     * Gets the dataSetAsByteArray value for this DataSetWEKAImpl.
     * 
     * @return dataSetAsByteArray
     */
    public byte[] getDataSetAsByteArray() {
        return dataSetAsByteArray;
    }


    /**
     * Sets the dataSetAsByteArray value for this DataSetWEKAImpl.
     * 
     * @param dataSetAsByteArray
     */
    public void setDataSetAsByteArray(byte[] dataSetAsByteArray) {
        this.dataSetAsByteArray = dataSetAsByteArray;
    }


    /**
     * Gets the dataSetLocation value for this DataSetWEKAImpl.
     * 
     * @return dataSetLocation
     */
    public java.lang.String getDataSetLocation() {
        return dataSetLocation;
    }


    /**
     * Sets the dataSetLocation value for this DataSetWEKAImpl.
     * 
     * @param dataSetLocation
     */
    public void setDataSetLocation(java.lang.String dataSetLocation) {
        this.dataSetLocation = dataSetLocation;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof DataSetWEKAImpl)) return false;
        DataSetWEKAImpl other = (DataSetWEKAImpl) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true && 
            ((this.dataSetAsByteArray==null && other.getDataSetAsByteArray()==null) || 
             (this.dataSetAsByteArray!=null &&
              java.util.Arrays.equals(this.dataSetAsByteArray, other.getDataSetAsByteArray()))) &&
            ((this.dataSetLocation==null && other.getDataSetLocation()==null) || 
             (this.dataSetLocation!=null &&
              this.dataSetLocation.equals(other.getDataSetLocation())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getDataSetAsByteArray() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getDataSetAsByteArray());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getDataSetAsByteArray(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        if (getDataSetLocation() != null) {
            _hashCode += getDataSetLocation().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

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

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://core.OLASimpleDMAPIWEKAImpl.ola.edu.pl", "DataSetWEKAImpl"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("dataSetAsByteArray");
        elemField.setXmlName(new javax.xml.namespace.QName("http://core.OLASimpleDMAPIWEKAImpl.ola.edu.pl", "dataSetAsByteArray"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "base64Binary"));
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("dataSetLocation");
        elemField.setXmlName(new javax.xml.namespace.QName("http://core.OLASimpleDMAPIWEKAImpl.ola.edu.pl", "dataSetLocation"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}



As you see it has a constructor taking both fields as parameters and original constructor taking String is omited. Additionally some other methods are also omitted.

I suspect that the class construction is invalid but whilest generation there was no message that some class may be violating the JAX-RPC specification...

I'll be gratefull for some help.
Re: API class changed by WS Client code generation [message #555447 is a reply to message #554802] Thu, 26 August 2010 15:54 Go to previous message
Ivan Castro is currently offline Ivan CastroFriend
Messages: 8
Registered: February 2010
Junior Member
Hi,

Can you provide more information please.

Did you create a Bottom Up service from your class and then generated a client based on your service?

Thanks,

Ivan Castro
Previous Topic:improvements to "could not load the tomcat server configuration" message on linux
Next Topic:WTP usability
Goto Forum:
  


Current Time: Thu Apr 25 00:30:42 GMT 2024

Powered by FUDForum. Page generated in 0.04647 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top