Re: Help!! Objects with Vectors

[email protected] Mon, 16 Jun 2003 12:15:34 +0200
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
Hi,

Is your 'Contacto' object KvmSerializable ? Or did u define a custom 
marshaller for it ?

If 'no' is the answer to these 2 questions, you can try to construct your 
'Contacto' object
using a SoapObject this way :

SoapObject contacto = new SoapObject(this.serviceNamespace, "Contacto");
contacto.addProperty("id", new Integer(id));
contacto.addProperty("alias", alias);
...
// with this contruct you can specify what's the type of the vector 
elements and also wether multi-refs should be used
contacto.addProperty(new PropertyInfo("tipoTelefono", ElementType.VECTOR_CLASS, false, new 
ElementType(ElementType.STRING.CLASS)));
...

request = new SoapObject(this.serviceNamespace,"Alta");
request.addProperty("Contacto", contacto);
...

Hope it helps,

----------------------------------------------------------------------------
Sebastien Petrucci
Java Technology Consultant - Altran Europe
Philips Remote Control Systems
Interleuvenlaan 74-76, B-3001 Leuven (Belgium)
M +32(0)497502521    T  +32(0)16394 598
----------------------------------------------------------------------------









"Jose Manuel Kiernan" <[email protected]>
Sent by: 
[email protected]
2003-06-16 11:49
Please respond to ksoap

 
        To:     <[email protected]>
        cc:     (bcc: Sebastien Petrucci/LEU/COMP/PHILIPS)
        Subject:        Ksoap:  Help!! Objects with Vectors
        Classification: 



Hello. I've a problem with ksoap vectors: I can send and recive vectors 
but when I try to send an object that it has an 
vector like attribute of this object in the server side I get the object 
well. However the vector's values are null.
What can I do? I've tried it a lot of diferents ways but I couldn't make 
that the program working.
 
I'm using ksoap like client and Apache Soap 3.2.4 like server. Thanks
 
My code:
    HttpTransport transport;
    SoapObject request;
    ClassMap classMap;
 
    ... 
    request = new SoapObject(this.serviceNamespace,"Alta");
    classMap =new ClassMap(); 
 
classMap.addMapping(this.serviceNamespace,"Contacto",this.contacto.getClass());
    transport =new HttpTransport(serviceUrl, "AgendaService#Alta");
    transport.setClassMap(classMap);
    transport.debug=true;
    request.addProperty("Contacto",this.contacto);
 
    int nuevoId= ((Integer)transport.call(request)).intValue();  
    ...
 
type contacto:
 
  int id;
  String alias; 
  String nombre;
  String apellidos;
  int numTlf;
  Vector tipoTelefono; 
  Vector telefonos; 
  String email;
  String direccion;
  String codigoPostal;
  String poblacion;
  String provincia;
  String notas;





_________________________________________________________________
  IncrediMail - El E-mail ha evolucionado finalmente - Haga clic aquĆ­