You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by bohldan bohldan <gl...@hotmail.com> on 2005/03/14 11:50:31 UTC

Array deserialzation (Bad types)

Error msg: org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> 
class GlazeService.User)
What is wrong what do i have to do.. ?

public class Client {
	public static void main(String[] args) {
		try{
			String endpointURL = "http://localhost:8080/axis/services/GlazeService";
			Service service = new Service();
			Call call = (Call) service.createCall();
			QName qn = new QName( "urn:GlazeService.Service", "User" );
			call.setOperationName("ldap_GetAllUsernames");
			call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
			call.registerTypeMapping( User.class,
					qn,
					org.apache.axis.encoding.ser.BeanSerializerFactory.class,
					org.apache.axis.encoding.ser.BeanDeserializerFactory.class );
			call.setReturnType(qn);
		    User[] tomte = (User[])call.invoke(new Object [] {});
		    System.out.println("Size: " + tomte.length);
		    for(int i = 0; i < tomte.length; i++){
		    	System.out.println(tomte[i].GetGecos());
		    }
		}catch(Exception e){
			System.out.println("Something is really fucked up: " + e.toString());
		}
	}
}


-----

WSDD FILE:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
	xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
	xmlns:glaze="http://www.soapinterop.org/dealService">
	<service name="GlazeService" provider="java:RPC">
	<parameter name="className" value="GlazeService.Service"/>
	<parameter name="allowedMethods" value="*"/>
        <operation name="ldap_GetAllUsernames" 
qname="glaze:ldap_GetAllUsernames"
                 returnQName="ldap_GetAllUsernamesReturn"
                 returnType="glaze:ArrayOfUser">
      </operation>
    </service>
    <beanMapping qname="glaze:User" 
languageSpecificType="java:GlazeService.User"/>
    <typeMapping qname="glaze:ArrayOfUser" type="java:GlazeService.User[]"
      serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
      deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</deployment>

_________________________________________________________________
Chat: Ha en fest på Habbo Hotel 
http://habbohotel.msn.se/habbo/sv/channelizer Checka in här!