You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Br...@correspondence.school.nz on 2003/06/10 00:41:26 UTC
Unregistered Deserializer???
Hi,
I'm trying to return an array of beans, and am having problems. I'm using
axis 1.1 rc2. The first message I got was that my student class had no
registered serializer, so I added this to my deploy.wsdd:
<beanMapping
qname="myNS:com.greenpulse.demo.model.Student"
xmlns:myNS="urn:BeanService"
languageSpecificType="java:com.greenpulse.demo.model.Student"
/>
Then I got a message about their being no registered deserializer, so I
added this to my simple client class:
call.registerTypeMapping(Student.class,
new QName("urn:BeanService",
"com.greenpulse.demo.model.Student"),
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
However, this didn't help.
So, I'm lost, and would appreciate some help :-)
Here's my java and deployment files:
TIA -- Bryan
Main:
private static void getStudents(String search) throws ServiceException,
RemoteException
{
System.out.println("Getting students");
Service service = new Service();
Call call = (Call) service.createCall();
call.registerTypeMapping(Student.class,
new QName("urn:BeanService",
"com.greenpulse.demo.model.Student"),
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.setTargetEndpointAddress(ADDRESS);
call.setOperation("getByName");
String[] args = {search};
System.out.println("invoking");
Object o = call.invoke(args);
System.out.println("o = " + o);
}
--
Students.java
package com.greenpulse.demo.model;
import java.util.Vector;
public class Students
{
public Vector getByName(String name)
{
Vector v = new Vector();
for (int i = 0; i < 10; i++)
v.add(new Student("id " + i,
"male",
"25/12/1980",
"En",
"comment " + i,
"email" + i + "
@nowhere.com",
"Mr",
"family " + i,
"given " + i));
return v;
}
}
--
Student.java
package com.greenpulse.demo.model;
import java.io.Serializable;
/**
* Correspondence School (c) 2003 All rights reserved
* www.demo.greenpulse.com
*/
public class Student
{
private String studentID;
private String gender;
private String birthDate;
private String FirstLanguage;
private String comment;
private String email;
private String title;
private String familyName;
private String givenNames;
public Student()
{
}
public Student(String studentID, String gender, String birthDate,
String firstLanguage, String comment, String email, String title, String
familyName, String givenNames)
{
this.setStudentID(studentID);
this.setGender(gender);
this.setBirthDate(birthDate);
this.setFirstLanguage(firstLanguage);
this.setComment(comment);
this.setEmail(email);
this.setTitle(title);
this.setFamilyName(familyName);
this.setGivenNames(givenNames);
}
public String getStudentID()
{
return studentID;
}
public void setStudentID(String studentID)
{
this.studentID = studentID;
}
public String getGender()
{
return gender;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getBirthDate()
{
return birthDate;
}
public void setBirthDate(String birthDate)
{
this.birthDate = birthDate;
}
public String getFirstLanguage()
{
return FirstLanguage;
}
public void setFirstLanguage(String firstLanguage)
{
FirstLanguage = firstLanguage;
}
public String getComment()
{
return comment;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getFamilyName()
{
return familyName;
}
public void setFamilyName(String familyName)
{
this.familyName = familyName;
}
public String getGivenNames()
{
return givenNames;
}
public void setGivenNames(String givenNames)
{
this.givenNames = givenNames;
}
public String toString()
{
return this.studentID + " " +
this.gender + " " +
this.birthDate + " " +
this.FirstLanguage + " \"" +
this.comment + "\" " +
this.email + " " +
this.title + " " +
this.familyName + " " +
this.givenNames;
}
}
Cheers,
Bryan
Re: Unregistered Deserializer???
Posted by "H. William Connors II" <bc...@rochgrp.com>.
Well I'm not sure based on the error that you got but one thing I
noticed is that your Student class doesn't implement serializable.
Bill
Bryan.Dollery@correspondence.school.nz wrote:
>Hi,
>
>I'm trying to return an array of beans, and am having problems. I'm using
>axis 1.1 rc2. The first message I got was that my student class had no
>registered serializer, so I added this to my deploy.wsdd:
>
> <beanMapping
> qname="myNS:com.greenpulse.demo.model.Student"
> xmlns:myNS="urn:BeanService"
> languageSpecificType="java:com.greenpulse.demo.model.Student"
> />
>
>Then I got a message about their being no registered deserializer, so I
>added this to my simple client class:
>
> call.registerTypeMapping(Student.class,
> new QName("urn:BeanService",
> "com.greenpulse.demo.model.Student"),
> BeanSerializerFactory.class,
> BeanDeserializerFactory.class);
>
>
>However, this didn't help.
>
>So, I'm lost, and would appreciate some help :-)
>
>Here's my java and deployment files:
>
>TIA -- Bryan
>
>Main:
>private static void getStudents(String search) throws ServiceException,
>RemoteException
>{
> System.out.println("Getting students");
> Service service = new Service();
> Call call = (Call) service.createCall();
> call.registerTypeMapping(Student.class,
> new QName("urn:BeanService",
> "com.greenpulse.demo.model.Student"),
> BeanSerializerFactory.class,
> BeanDeserializerFactory.class);
>
> call.setTargetEndpointAddress(ADDRESS);
> call.setOperation("getByName");
> String[] args = {search};
> System.out.println("invoking");
> Object o = call.invoke(args);
> System.out.println("o = " + o);
>}
>
>--
>
>Students.java
>package com.greenpulse.demo.model;
>
>import java.util.Vector;
>
>public class Students
>{
> public Vector getByName(String name)
> {
> Vector v = new Vector();
> for (int i = 0; i < 10; i++)
> v.add(new Student("id " + i,
> "male",
> "25/12/1980",
> "En",
> "comment " + i,
> "email" + i + "
>@nowhere.com",
> "Mr",
> "family " + i,
> "given " + i));
> return v;
> }
>}
>
>--
>Student.java
>package com.greenpulse.demo.model;
>
>import java.io.Serializable;
>
>/**
> * Correspondence School (c) 2003 All rights reserved
> * www.demo.greenpulse.com
> */
>public class Student
>{
> private String studentID;
> private String gender;
> private String birthDate;
> private String FirstLanguage;
> private String comment;
> private String email;
> private String title;
> private String familyName;
> private String givenNames;
>
> public Student()
> {
> }
>
> public Student(String studentID, String gender, String birthDate,
>String firstLanguage, String comment, String email, String title, String
>familyName, String givenNames)
> {
> this.setStudentID(studentID);
> this.setGender(gender);
> this.setBirthDate(birthDate);
> this.setFirstLanguage(firstLanguage);
> this.setComment(comment);
> this.setEmail(email);
> this.setTitle(title);
> this.setFamilyName(familyName);
> this.setGivenNames(givenNames);
> }
>
> public String getStudentID()
> {
> return studentID;
> }
>
> public void setStudentID(String studentID)
> {
> this.studentID = studentID;
> }
>
> public String getGender()
> {
> return gender;
> }
>
> public void setGender(String gender)
> {
> this.gender = gender;
> }
>
> public String getBirthDate()
> {
> return birthDate;
> }
>
> public void setBirthDate(String birthDate)
> {
> this.birthDate = birthDate;
> }
>
> public String getFirstLanguage()
> {
> return FirstLanguage;
> }
>
> public void setFirstLanguage(String firstLanguage)
> {
> FirstLanguage = firstLanguage;
> }
>
> public String getComment()
> {
> return comment;
> }
>
> public void setComment(String comment)
> {
> this.comment = comment;
> }
>
> public String getEmail()
> {
> return email;
> }
>
> public void setEmail(String email)
> {
> this.email = email;
> }
>
> public String getTitle()
> {
> return title;
> }
>
> public void setTitle(String title)
> {
> this.title = title;
> }
>
> public String getFamilyName()
> {
> return familyName;
> }
>
> public void setFamilyName(String familyName)
> {
> this.familyName = familyName;
> }
>
> public String getGivenNames()
> {
> return givenNames;
> }
>
> public void setGivenNames(String givenNames)
> {
> this.givenNames = givenNames;
> }
>
> public String toString()
> {
> return this.studentID + " " +
> this.gender + " " +
> this.birthDate + " " +
> this.FirstLanguage + " \"" +
> this.comment + "\" " +
> this.email + " " +
> this.title + " " +
> this.familyName + " " +
> this.givenNames;
>
> }
>}
>
>
>Cheers,
>
>Bryan
>
>
>
>
Re: Unregistered Deserializer???
Posted by Venkatesh Kancharla <ve...@strandgenomics.com>.
Hi Bryan,
You are returning a vector. So, you need to specify serializer for
both vector and Student.
Venkatesh Kancharla
Associate (Software)
Strand Genomics (http://www.strandgenomics.com)
Bangalore, India
Ph no: 3618992,93, 94, 95 (ext-210)
---------------------------------------------------------------------
If Necessity Is the Mother of Invention,
then frustration Is Its Father
-unknown
---------------------------------------------------------------------
On Tue, 10 Jun 2003 Bryan.Dollery@correspondence.school.nz wrote:
> Hi,
>
> I'm trying to return an array of beans, and am having problems. I'm using
> axis 1.1 rc2. The first message I got was that my student class had no
> registered serializer, so I added this to my deploy.wsdd:
>
> <beanMapping
> qname="myNS:com.greenpulse.demo.model.Student"
> xmlns:myNS="urn:BeanService"
> languageSpecificType="java:com.greenpulse.demo.model.Student"
> />
>
> Then I got a message about their being no registered deserializer, so I
> added this to my simple client class:
>
> call.registerTypeMapping(Student.class,
> new QName("urn:BeanService",
> "com.greenpulse.demo.model.Student"),
> BeanSerializerFactory.class,
> BeanDeserializerFactory.class);
>
>
> However, this didn't help.
>
> So, I'm lost, and would appreciate some help :-)
>
> Here's my java and deployment files:
>
> TIA -- Bryan
>
> Main:
> private static void getStudents(String search) throws ServiceException,
> RemoteException
> {
> System.out.println("Getting students");
> Service service = new Service();
> Call call = (Call) service.createCall();
> call.registerTypeMapping(Student.class,
> new QName("urn:BeanService",
> "com.greenpulse.demo.model.Student"),
> BeanSerializerFactory.class,
> BeanDeserializerFactory.class);
>
> call.setTargetEndpointAddress(ADDRESS);
> call.setOperation("getByName");
> String[] args = {search};
> System.out.println("invoking");
> Object o = call.invoke(args);
> System.out.println("o = " + o);
> }
>
> --
>
> Students.java
> package com.greenpulse.demo.model;
>
> import java.util.Vector;
>
> public class Students
> {
> public Vector getByName(String name)
> {
> Vector v = new Vector();
> for (int i = 0; i < 10; i++)
> v.add(new Student("id " + i,
> "male",
> "25/12/1980",
> "En",
> "comment " + i,
> "email" + i + "
> @nowhere.com",
> "Mr",
> "family " + i,
> "given " + i));
> return v;
> }
> }
>
> --
> Student.java
> package com.greenpulse.demo.model;
>
> import java.io.Serializable;
>
> /**
> * Correspondence School (c) 2003 All rights reserved
> * www.demo.greenpulse.com
> */
> public class Student
> {
> private String studentID;
> private String gender;
> private String birthDate;
> private String FirstLanguage;
> private String comment;
> private String email;
> private String title;
> private String familyName;
> private String givenNames;
>
> public Student()
> {
> }
>
> public Student(String studentID, String gender, String birthDate,
> String firstLanguage, String comment, String email, String title, String
> familyName, String givenNames)
> {
> this.setStudentID(studentID);
> this.setGender(gender);
> this.setBirthDate(birthDate);
> this.setFirstLanguage(firstLanguage);
> this.setComment(comment);
> this.setEmail(email);
> this.setTitle(title);
> this.setFamilyName(familyName);
> this.setGivenNames(givenNames);
> }
>
> public String getStudentID()
> {
> return studentID;
> }
>
> public void setStudentID(String studentID)
> {
> this.studentID = studentID;
> }
>
> public String getGender()
> {
> return gender;
> }
>
> public void setGender(String gender)
> {
> this.gender = gender;
> }
>
> public String getBirthDate()
> {
> return birthDate;
> }
>
> public void setBirthDate(String birthDate)
> {
> this.birthDate = birthDate;
> }
>
> public String getFirstLanguage()
> {
> return FirstLanguage;
> }
>
> public void setFirstLanguage(String firstLanguage)
> {
> FirstLanguage = firstLanguage;
> }
>
> public String getComment()
> {
> return comment;
> }
>
> public void setComment(String comment)
> {
> this.comment = comment;
> }
>
> public String getEmail()
> {
> return email;
> }
>
> public void setEmail(String email)
> {
> this.email = email;
> }
>
> public String getTitle()
> {
> return title;
> }
>
> public void setTitle(String title)
> {
> this.title = title;
> }
>
> public String getFamilyName()
> {
> return familyName;
> }
>
> public void setFamilyName(String familyName)
> {
> this.familyName = familyName;
> }
>
> public String getGivenNames()
> {
> return givenNames;
> }
>
> public void setGivenNames(String givenNames)
> {
> this.givenNames = givenNames;
> }
>
> public String toString()
> {
> return this.studentID + " " +
> this.gender + " " +
> this.birthDate + " " +
> this.FirstLanguage + " \"" +
> this.comment + "\" " +
> this.email + " " +
> this.title + " " +
> this.familyName + " " +
> this.givenNames;
>
> }
> }
>
>
> Cheers,
>
> Bryan
>
>