Lasse Koskela wrote:
Originally posted by Yann Emeraud:
But what is a deserializer?
A deserializer is a class that knows how to deserialize a certain type of XML tree into a Java object. A serializer is the counterpart which knows how to serialize a certain type of Java object into XML.
Web services engines provide built-in de/serializers for the basic data types such as Integer and String, and some collection classes as well, but if your particular return type (or parameter type) is not one of those, you need to write your own (and the way you do this is dependent on your particular web services engine).
Hi Sheriff,
I am facing the Deserializer error in my Web service.. Can you send me the sample code to do Serealize & Deserialize..
If you send me the Code it helps me a lot.. Please help me..
My Web Service java classes are as below..
CPServices.java
public class CPServices implements Serializable
{
public void smsMo(java.lang.String service_id, java.lang.String source_mobtel,
java.lang.String sub_id, java.lang.String keyword, java.lang.String transaction_id,
java.lang.String short_code_suffix_ind, java.lang.String short_code_suffix, SMSContent[]
sms_contents)
{
}
}
SMSConetent.java
public class SMSContent implements Serializable
{
public java.lang.String content;
public java.lang.String ucp_data_coding_id;
public java.lang.String ucp_msg_class;
public java.lang.String ucp_msg_type;
public SMSContent()
{
System.out.println("--------Inside SMSContent() Constructor-----------");
}
public SMSContent(java.lang.String content, java.lang.String ucp_data_coding_id,
java.lang.String ucp_msg_class, java.lang.String ucp_msg_type)
{
if (content == null)
{
throw new IllegalArgumentException("Content is null!");
}
if (ucp_data_coding_id == null)
{
throw new IllegalArgumentException("ucp_data_coding_id is null!");
}
if (ucp_msg_class == null)
{
throw new IllegalArgumentException("ucp_msg_class is null!");
}
if (ucp_msg_type == null)
{
throw new IllegalArgumentException("ucp_msg_type is null!");
}
this.content = content;
this.ucp_data_coding_id = ucp_data_coding_id;
this.ucp_msg_class = ucp_msg_class;
this.ucp_msg_type = ucp_msg_type;
}
public String getContent() {
return content;
}
public void setContent(java.lang.String content) {
this.content = content;
}
public java.lang.String getUcp_data_coding_id() {
return ucp_data_coding_id;
}
public void setUcp_data_coding_id(java.lang.String ucp_data_coding_id) {
this.ucp_data_coding_id = ucp_data_coding_id;
}
public java.lang.String getUcp_msg_class() {
return ucp_msg_class;
}
public void setUcp_msg_class(java.lang.String ucp_msg_class) {
this.ucp_msg_class = ucp_msg_class;
}
public java.lang.String getUcp_msg_type() {
return ucp_msg_type;
}
public void setUcp_msg_type(java.lang.String ucp_msg_type) {
this.ucp_msg_type = ucp_msg_type;
}
/**
* Test for equality.
* @param object any object
* @return true if parameters are equal
*/
public boolean equals(Object object)
{
if ((object instanceof SMSContent))
{
SMSContent secondSMSC = (SMSContent) object;
return secondSMSC.content.equals(secondSMSC.content) &&
secondSMSC.ucp_data_coding_id.equals(secondSMSC.ucp_data_coding_id) &&
secondSMSC.ucp_msg_class.equals(secondSMSC.ucp_msg_class) &&
secondSMSC.ucp_msg_type.equals(secondSMSC.ucp_msg_type);
}
return false;
}
}
When i call the smsMo() from the WebService i am getting below error:
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>org.xml.sax.SAXException: No deserializer for {http://DefaultNamespace}SMSContent</faultstring>
- <detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">sfjdev</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Canu please help me regarding this how to get the Deserializer for this..
Thanks in advance....