I try to call a service from an Axis java client, using the following code, and store my result in a bean class "Localite" using a BenaDeserializer:


   public static void main(String [] args) {
       try {
       	
		String endpoint = "http://127.0.0.1:5000/";
     
		Service  service = new Service();
		Call     call    = (Call) service.createCall();
		call.setUseSOAPAction(true);
		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
		call.setOperationName(new QName("http://tempuri.org/ns.xsd", "getAdresse") );
        
		// register "Localite" Bean classes
		
		QName localite_qn = new QName("http://tempuri.org/ns.xsd","Localite");
		call.registerTypeMapping(Localite.class, localite_qn, new BeanSerializerFactory(Localite.class, localite_qn), new BeanDeserializerFactory(Localite.class, localite_qn));
		
		call.setReturnType( localite_qn, Localite.class );
		
		Localite loc_out = (Localite) call.invoke( new Object[] { } );
		
		System.out.println("Result: '" + loc_out + "'");
       } catch (Exception e) {
           System.err.println(e.toString());
       }
   }


the "getAdresse" service is deployed (using gSoap), and everything goes OK until the server return the result message containing the soap enveloppe:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/ns.xsd">
      <SOAP-ENV:Body>
         <ns:Localite>
            <id>3</id>
            <libelle>Bourg la reine</libelle>
            <popu>10000</popu>
         </ns:Localite>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

The problem is that I cannot find a way to deserialize this flow. The client code result in an empty "Localite" Object. No setter is called (setId or setLibelle or setPopu).
I tried differents things to interpret my result, but I could'nt find any way to do this so far !
If I define my result type as String:
call.setReturnClass( String.class );
String loc_out = (String) call.invoke( new Object[] { } );
I get "3" (the id value).


Can somebody tell me what I do wrong or what is missing in my code ???
I

Jean-Baptiste HUNTZINGER

Reply via email to