cancel
Showing results for 
Search instead for 
Did you mean: 

XML deserialization error

Former Member
0 Kudos

Hi all,

I am following the SAP WEBAS 6.4 tutorials to create the Customer web service. When I execute the register method I get the following error message:

"Deserializing fails. Nested message: XML Deserialization Error. Can not create instance of class [com.sap.demo.customer.common.CustomerDTO] when deserializing XML type [urn:com.sap.demo.customer.common][CustomerDTO]..

I tried adding an empty constructor to the CustomerDTO class. This removes the error but the register method fails to insert data into the customer table.

Please help

Thanks,

Jay

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Victor,

Thanks for the reply. Here is my code for the CustomerDTO class.

I have a default constructor, and the class implements Serializable.

package com.sap.demo.customer.common;

import java.io.Serializable;

public class CustomerDTO implements Serializable {

private String form;

private String name;

private String street;

private String zip;

private String city;

private String country;

private String phone;

private String email;

private String username;

private String password;

// Constructor

public CustomerDTO(String form,

String name,

String street,

String zip,

String city,

String country,

String phone,

String email,

String username,

String password)

{

this.form = form;

this.name = name;

this.street = street;

this.zip = zip;

this.city = city;

this.country = country;

this.phone = phone;

this.email = email;

this.username = username;

this.password = password;

}

public CustomerDTO() {}

/**

  • @return

*/

public String getCity() {

return city;

}

/**

  • @return

*/

public String getCountry() {

return country;

}

/**

  • @return

*/

public String getEmail() {

return email;

}

/**

  • @return

*/

public String getForm() {

return form;

}

/**

  • @return

*/

public String getName() {

return name;

}

/**

  • @return

*/

public String getPassword() {

return password;

}

/**

  • @return

*/

public String getPhone() {

return phone;

}

/**

  • @return

*/

public String getStreet() {

return street;

}

/**

  • @return

*/

public String getUsername() {

return username;

}

/**

  • @return

*/

public String getZip() {

return zip;

}

/**

  • @param string

*/

public void setCity(String string) {

city = string;

}

/**

  • @param string

*/

public void setCountry(String string) {

country = string;

}

/**

  • @param string

*/

public void setEmail(String string) {

email = string;

}

/**

  • @param string

*/

public void setForm(String string) {

form = string;

}

/**

  • @param string

*/

public void setName(String string) {

name = string;

}

/**

  • @param string

*/

public void setPassword(String string) {

password = string;

}

/**

  • @param string

*/

public void setPhone(String string) {

phone = string;

}

/**

  • @param string

*/

public void setStreet(String string) {

street = string;

}

/**

  • @param string

*/

public void setUsername(String string) {

username = string;

}

/**

  • @param string

*/

public void setZip(String string) {

zip = string;

}

}

Thanks,

Jay.

Former Member
0 Kudos

Hi,

In order to make your class serializable you should do the following:

1. implement Serializible

2. Create public default construcor.

3. For each property named <b>property</b> you should create getProperty and setProperty public methods.

Also, please check this:

Hope it helps.

Victor.