On 29 August 2010 07:45, Wolfgang Laun <wolfgang.laun_at_gmail.com> wrote:
>
> One thing that looks curious at a first glance is that there are two
> different classes for PacienteDTO, one at client and one at server side.
> Usually you should have the same JAXB-annotated code at both ends, as this
> will guarantee symmetric marshalling and unmarshalling.
>
> Also, there is no package org.app.dev.client; in the server side client,
> and so the generated XML will be in the default namespace (cf. the generated
> XML schema. Chances are, that some namespace issue will arise.
>
> Do you have any other classes? An ObjectFactory.java?
>
> -W
>
>
>
> On 29 August 2010 08:49, JULIAN ENRIQUE OSORIO AMAYA <
> juliane.osorioa_at_unilibrebog.edu.co> wrote:
>
>> Greetings
>>
>> I'm developing a web service and a j2me client using Netbeans 6.7.1.
>>
>> The j2me client sends an image to be stored in a mysql db and I need to be
>> sure that the generated classes are correct.
>>
>> Here is the Pojo at server side
>>
>> import javax.activation.DataHandler;
>> import javax.xml.bind.annotation.XmlAccessType;
>> import javax.xml.bind.annotation.XmlAccessorType;
>> import javax.xml.bind.annotation.XmlElement;
>> import javax.xml.bind.annotation.XmlType;
>> import javax.xml.bind.annotation.XmlMimeType;
>>
>> @XmlAccessorType(XmlAccessType.FIELD)
>> @XmlType(name="PacienteDTO", propOrder={"idPaciente", "nombrePaciente",
>> "apellidoPaciente", "nombreImagen", "imagenPaciente", "fecha",
>> "idUsuarioExterno", "idUsuarioInterno"})
>> public class PacienteDTO {
>> @XmlElement(required=true)
>> private String idPaciente;
>> @XmlElement(required=true)
>> private String nombrePaciente;
>> @XmlElement(required=true)
>> private String apellidoPaciente;
>> @XmlElement(required=true,nillable=true)
>> private String nombreImagen;
>> @XmlMimeType("image/jpeg")
>> private DataHandler imagenPaciente;
>> @XmlElement(required=true,nillable=true)
>> private String fecha;
>> @XmlElement(required=true)
>> private String idUsuarioExterno;
>> @XmlElement(required=true)
>> private String idUsuarioInterno;
>> public PacienteDTO() {
>>
>> }
>> public String getApellidoPaciente() {
>> return apellidoPaciente;
>> }
>>
>> public String getFecha() {
>> return fecha;
>> }
>>
>> public void setFecha(String fecha) {
>> this.fecha = fecha;
>> }
>>
>> public String getIdPaciente() {
>> return idPaciente;
>> }
>>
>> public void setIdPaciente(String idPaciente) {
>> this.idPaciente = idPaciente;
>> }
>>
>> public String getIdUsuarioExterno() {
>> return idUsuarioExterno;
>> }
>>
>> public void setIdUsuarioExterno(String idUsuarioExterno) {
>> this.idUsuarioExterno = idUsuarioExterno;
>> }
>>
>> public String getIdUsuarioInterno() {
>> return idUsuarioInterno;
>> }
>>
>> public void setIdUsuarioInterno(String idUsuarioInterno) {
>> this.idUsuarioInterno = idUsuarioInterno;
>> }
>>
>> public DataHandler getImagenPaciente() {
>> return imagenPaciente;
>> }
>>
>> public void setImagenPaciente(DataHandler imagenPaciente) {
>> this.imagenPaciente = imagenPaciente;
>> }
>>
>> public String getNombreImagen() {
>> return nombreImagen;
>> }
>>
>> public void setNombreImagen(String nombreImagen) {
>> this.nombreImagen = nombreImagen;
>> }
>>
>> public String getNombrePaciente() {
>> return nombrePaciente;
>> }
>>
>> public void setNombrePaciente(String nombrePaciente) {
>> this.nombrePaciente = nombrePaciente;
>> }
>>
>> }
>>
>>
>> Here is the schema generated by the schemagen command
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>
>> <xs:complexType name="PacienteDTO">
>> <xs:sequence>
>> <xs:element name="idPaciente" type="xs:string"/>
>> <xs:element name="nombrePaciente" type="xs:string"/>
>> <xs:element name="apellidoPaciente" type="xs:string"/>
>> <xs:element name="nombreImagen" type="xs:string" nillable="true"/>
>> <xs:element name="imagenPaciente"
>> ns1:expectedContentTypes="image/jpeg" type="xs:base64Binary" minOccurs="0"
>> xmlns:ns1="http://www.w3.org/2005/05/xmlmime"/>
>> <xs:element name="fecha" type="xs:string" nillable="true"/>
>> <xs:element name="idUsuarioExterno" type="xs:string"/>
>> <xs:element name="idUsuarioInterno" type="xs:string"/>
>> </xs:sequence>
>> </xs:complexType>
>>
>> <xs:complexType name="UsuarioDTO">
>> <xs:sequence>
>> <xs:element name="id" type="xs:string"/>
>> <xs:element name="nombre" type="xs:string"/>
>> <xs:element name="apellido" type="xs:string"/>
>> <xs:element name="usuario" type="xs:string"/>
>> <xs:element name="password" type="xs:string"/>
>> <xs:element name="email" type="xs:string"/>
>> <xs:element name="idRol" type="xs:int"/>
>> </xs:sequence>
>> </xs:complexType>
>>
>> <xs:complexType name="DiagnosticoDTO">
>> <xs:sequence>
>> <xs:element name="idPaciente" type="xs:string"/>
>> <xs:element name="diagnostico" type="xs:string"/>
>> <xs:element name="comentarios" type="xs:string" nillable="true"/>
>> <xs:element name="fecha" type="xs:string" nillable="true"/>
>> <xs:element name="idUsuarioOrigen" type="xs:string"/>
>> <xs:element name="idUsuarioDestino" type="xs:string"/>
>> </xs:sequence>
>> </xs:complexType>
>> </xs:schema>
>>
>>
>> Here is the Pojo at client side
>>
>> package org.app.dev.client;
>>
>> import javax.xml.namespace.QName;
>> public class PacienteDTO {
>>
>> private String idPaciente;
>>
>> public void setIdPaciente( String idPaciente ) {
>> this.idPaciente = idPaciente;
>> }
>>
>> public String getIdPaciente() {
>> return idPaciente;
>> }
>>
>> private String nombrePaciente;
>>
>> public void setNombrePaciente( String nombrePaciente ) {
>> this.nombrePaciente = nombrePaciente;
>> }
>>
>> public String getNombrePaciente() {
>> return nombrePaciente;
>> }
>>
>> private String apellidoPaciente;
>>
>> public void setApellidoPaciente( String apellidoPaciente ) {
>> this.apellidoPaciente = apellidoPaciente;
>> }
>>
>> public String getApellidoPaciente() {
>> return apellidoPaciente;
>> }
>>
>> private String nombreImagen;
>>
>> public void setNombreImagen( String nombreImagen ) {
>> this.nombreImagen = nombreImagen;
>> }
>>
>> public String getNombreImagen() {
>> return nombreImagen;
>> }
>>
>> private byte[] imagenPaciente;
>>
>> public void setImagenPaciente( byte[] imagenPaciente ) {
>> this.imagenPaciente = imagenPaciente;
>> }
>>
>> public byte[] getImagenPaciente() {
>> return imagenPaciente;
>> }
>>
>> private String fecha;
>>
>> public void setFecha( String fecha ) {
>> this.fecha = fecha;
>> }
>>
>> public String getFecha() {
>> return fecha;
>> }
>>
>> private String idUsuarioExterno;
>>
>> public void setIdUsuarioExterno( String idUsuarioExterno ) {
>> this.idUsuarioExterno = idUsuarioExterno;
>> }
>>
>> public String getIdUsuarioExterno() {
>> return idUsuarioExterno;
>> }
>>
>> private String idUsuarioInterno;
>>
>> public void setIdUsuarioInterno( String idUsuarioInterno ) {
>> this.idUsuarioInterno = idUsuarioInterno;
>> }
>>
>> public String getIdUsuarioInterno() {
>> return idUsuarioInterno;
>> }
>>
>> }
>>
>>
>> Is it ok or do I need to do some changes?
>>
>> Thanks for your time.
>>
>> --
>> Julian Osorio Amaya
>> Universidad Libre.
>> Ingeniería de Sistemas.
>> Bogota - Colombia
>>
>>
>
Hello Wolfgang
This are the generated classes at client side
package org.app.dev.client
DiagnosticoDTO.java
N95WSService.java
N95WSService.wsclient
N95WSService.wsdl
N95WSService_Stub.java
PacienteDTO.java
UsuarioDTO.java
This are the the generated classes at server side
package org.app.mobile.web.binding
DiagnosticoDTO.java
ObjectFactory.java
PacienteDTO.java
UsuarioDTO.java
Here is the ObjectFactory.java, generated at server side
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB)
Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="
http://java.sun.com/xml/jaxb">
http://java.sun.com/xml/jaxb
</a>
// Any modifications to this file will be lost upon recompilation of the
source schema.
// Generated on: 2010.08.28 at 08:10:21 PM COT
//
package org.app.mobile.web.binding;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.app.mobile.web.binding package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances
of schema derived classes for package: org.app.mobile.web.binding
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {_at_link PacienteDTO }
*
*/
public PacienteDTO createPacienteDTO() {
return new PacienteDTO();
}
/**
* Create an instance of {_at_link UsuarioDTO }
*
*/
public UsuarioDTO createUsuarioDTO() {
return new UsuarioDTO();
}
/**
* Create an instance of {_at_link DiagnosticoDTO }
*
*/
public DiagnosticoDTO createDiagnosticoDTO() {
return new DiagnosticoDTO();
}
}
Thanks
--
Julian Osorio Amaya
Universidad Libre.
Ingeniería de Sistemas.
Bogota - Colombia