axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Houman Moshtagh" <dev_w...@yahoo.de>
Subject Pass an Object (example) - Need an own Serializer?
Date Sun, 28 Jul 2002 20:29:56 GMT
Hi,

Finally I could manage to install the Tomcat and Axis 3 after 8 hours on
my Laptop.  PC doesn't still work. (Execption)

I could successfully deploy a simple "Helloworld" class.
Now I want make a simple thing: passing an UserData object.

package step.objects;

public class UserData {
	
	private String _userName;
	private int _userAge;
	
	public void setUserName (String userName){
		_userName = userName;
	}
	
	public String getUserName (){
		return _userName;
	}
		
	public void setUserAge (int userAge){
		_userAge = userAge;
	}
	
	public int getUserAge (){
		return _userAge;
	}
}




package step.objects;

public class Wrapper {
		
	public UserData receiveObject() {
	
		UserData obj=new UserData();
		obj.setUserName ("John");
		obj.setUserAge (27);
		return obj;			
	}
}


So far its very easy.  I deploy the Wrapper Class, and the WSDL file has
a complex Type for UserData. Everything runs perfect.

Now I use WSDL2JAVA and make some Classes which I need for the Client
side.

I show you just my main class:

package localhost;

public class start {

	public static void main(String[] args) throws Exception {
		
		WrapperService service = new WrapperServiceLocator();
		Wrapper port = service.getreceiveObject ();

		step.objekts.UserData tmp;
		tmp=port.receiveObject ();
		System.out.println(tmp.getUserName());
		System.out.println(tmp.setUserAge());		
	}
}



AXIS made this UserData class which is used above automatically.  
I thought AXIS would use BEANS to serialize and deserialize the objects,
but it seems that I need my own serializer.



The error message is:
- Mapping Exception to AxisFault
AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
faultString: (500)Internal Server Error
faultActor: null
faultDetail:
...
java.io.IOException: No serializer found for class step.objekts.Objekt
in registry org.apache.axis.encoding.TypeMappingImpl@e434d
...
Caused by: java.io.IOException: No serializer found for class
step.objekts.Objekt in registry
org.apache.axis.encoding.TypeMappingImpl@e434d
...





What could be the problem?
Regards
Houman







UserData (made by AXIS)

package step.objects;

public class UserData implements java.io.Serializable {
    private java.lang.String userName;    
    private int userAge;

    public UserData() {
    }

    public java.lang.String getUserName() {
        return userName;
    }

    public void setUserName(java.lang.String userName) {
        this.userName = userName;
    }

    public int getUserAge() {
        return userAge;
    }

    public void setUserAge(int userAge) {
        this.userAge = userAge;
    }

    private Object __equalsCalc = null;
    public synchronized boolean equals(Object obj) {
        if (!(obj instanceof UserData)) return false;
        UserData other = (UserData) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true && 
            ((userName==null && other.getUserName()==null) || 
             (userName!=null &&
              userName.equals(other.getUserName()))) &&
            userAge == other.getUserAge();
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getUserName() != null) {
            _hashCode += getUserName().hashCode();
        }
        _hashCode += getUserAge();
        __hashCodeCalc = false;
        return _hashCode;
    }

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

    static {
        org.apache.axis.description.FieldDesc field = new
org.apache.axis.description.ElementDesc();
        field.setFieldName("userName");
        field.setXmlName(new javax.xml.namespace.QName("", "userName"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("userAge");
        field.setXmlName(new javax.xml.namespace.QName("", "userAge"));
        typeDesc.addFieldDesc(field);
    };

    /**
     * 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(
           String mechType, 
           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(
           String mechType, 
           Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}



__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de

Mime
View raw message