JWSDP, DII Client and method returning complex type(edit)
Yann Emeraud
Greenhorn
Joined: May 03, 2004
Posts: 15
posted
0
Hi, I read the The Java Web Service Tutorial Chapter 12 I wrote a static client stub calling remote methods returning various object (Integer, String, Vector...). It worked fine. Then i tried to do the same thing with a DDI client. When i call a method returning an String or Integer type object, everything are ok. But when i call a method returning a Vector type object,i get this error message: deserialization error: java.lang.NullPointerException Do you see where i am wrong? Here a small portion of my DII client:
Portion of the target WSDL file:
Thank your for your help [ May 05, 2004: Message edited by: Yann Emeraud ]
Yann Emeraud
Greenhorn
Joined: May 03, 2004
Posts: 15
posted
0
I saw a post that might explain my problem in java forum They say that if you want to call a remote method returning complex type you have to write yourself a "deserializer". But what is a deserializer?
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
5
posted
0
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).
Thanks you for the hint Lasse Koskela. I found what i m doing wrong on the above example. I didn't set the right namespace in the DIIClient QName QNAME_TYPE_VECTOR. In the shema making reference to Vector type in the WSDL file we can see:
But in my DII client source i set the targetNamespace like this:
To make the above example work, i simply have to change it to:
hi! I am trying to develop a dii client to return a complex type (in fact a custom type). the function should return an object of a class defined by me (DataHolder - consisting of an Integer and a string), and i am having a lot of trouble with that. can you please provide some help?
this is the config.xml file that i have written for the web service. should i change anything in it?
It provides a bean (de)serializer that will let you use your DataHolder easily.
You'll just have to add a line in your client and in your deploy.wsdd (axis's Example 5).
P.S: your DataHolder must map the javaBean schema (one setter and getter for each field, a constructor with no argument, ...)
Nagendra E Loli
Greenhorn
Joined: Feb 23, 2009
Posts: 12
posted
0
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..
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;