ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandros Panaretos" <>
Subject RE: SOAP Serialization problem
Date Tue, 10 Sep 2002 17:19:29 GMT
Hi Scott,

Thank you again for your reply I got one of the problems sorted. In the
case of the interface I would like to ask another detail if possible
please: When my Soap Client methods have a Java Interface Object that is
has various concrete implementations do I have to provide the type
mapping of the implementations in the deployment descriptor or only the
interface class.

Also When I create my SOAP Call Object and I pass the parameter do I
again pass the Interface class or the Implementation of that class?

I have tried it passing interface objects and it did not work.

Anyway thank you very much for your help.


-----Original Message-----
From: Scott Nichol [] 
Sent: Tuesday, September 10, 2002 5:42 PM
Subject: Re: SOAP Serialization problem

You can pass a JavaBean that has a property that is a Vector of another
JavaBean, but you must supply a mapping for the other class.  Basically,
any type you want to serialize that is not a Java primitive (e.g. float,
int), wrapper (e.g. Float, Integer) or one of the few others with
built-in serializer mappings (e.g. Date), you have to provide a
serializer mapping.

For working with interfaces, you would typically write your own
serializer, specifically because the deserializer must create an
instance of a concrete class.  This is done for collection interfaces.
Serializing interfaces, on the other hand, is no different than
serializing any class.  If you have an interface that follows the
JavaBean pattern, for example, I think you could serialize it using the

Scott Nichol

----- Original Message -----
From: "Alexandros Panaretos" <>
To: "'Scott Nichol'" <>;
Cc: <>
Sent: Tuesday, September 10, 2002 5:27 AM
Subject: RE: SOAP Serialization problem

Hi Scott,

Thanks for your e-mail. The problems I had before I managed to solve. I
discovered that when you are passing JavaBeans through SOAP using the
Bean Serializer despite the setters & getters you should and the empty
constructor if you have any other methods that start with a get or set
you should provide an equivalent set or get (empty) in order to work.

Anyway, I have another problem now: Is it possible to pass a JavaBean
through SOAP that one of its properties is Vector of another user
defined objects which are JavaBeans as well ?

Moreover I would like to ask if you can pass an Interface as a parameter
of a SOAP method and then inside the SOAP Client specify the
implementation class of the interface you want the Serializer and
Deserializer to use.

Thank you in advance.


-----Original Message-----
From: Scott Nichol []
Sent: Monday, September 09, 2002 9:08 PM
Subject: Re: SOAP Serialization problem

Can you describe the problems you are having?  Assuming you have getters
and setters for all properties you wish to serialize, and the properties
have data types that have serializers, BeanSerializer should work.  As
you have experienced, there are no serializers for URL or

Scott Nichol

----- Original Message -----
From: "Alexandros Panaretos" <>
To: <>
Sent: Monday, September 02, 2002 11:03 AM
Subject: SOAP Serialization problem

Hi there,

I am quite new to SOAP and would like some help with the following if

Well, I am trying to pass my user defined object through SOAP. Now, I
have read various tutorials about passing user defined objects through
SOAP. From what I have understood there two ways of doing so:

A. Code your object class as a JavaBean and the use the provided
beanSerializer or B. Create your own custom serializer & deserializer.

I am trying to do the first and I have a lot problems serializing the
following Java class:

<---------------  Start of Java Code ---------------->

import java.util.Vector;

public class MNistDataset implements ImageDataset {

    //InputStream is;
    //DataInputStream dis;

    //URL labelSetUrl;
    //URL imageSetUrl;

    String labelSetUrl;
    String imageSetUrl;

    byte[] labels;
    byte[] buf;

    Vector images;

    int maxPatterns = 1000000;
    int nImages;
    int nRows;
    int nCols;
    int nBytes;
    int nClasses;

    public MNistDataset(){


    public MNistDataset(String labelSetUrl, String imageSetUrl) throws
Exception {
        this.labelSetUrl = labelSetUrl;
        this.imageSetUrl = imageSetUrl;

    public MNistDataset(String labelSetUrl, String imageSetUrl, int
maxPatterns) throws Exception {
        this.labelSetUrl = labelSetUrl;
        this.imageSetUrl = imageSetUrl;
        this.maxPatterns = maxPatterns;

    public void readImageSet(String imageSetUrl) throws Exception {
        InputStream is;
        DataInputStream dis;

        is = new URL(imageSetUrl).openStream();
        dis = new DataInputStream(is);
        int magic = dis.readInt();
        //System.out.println("magic number is equal: " + magic);
        int n = dis.readInt();
        n = Math.min( maxPatterns , n );
        if (n != nImages) {
            throw new Exception(nImages + " <> " + n);
        nRows = dis.readInt();
        nCols = dis.readInt();
        images = new Vector();
        for (int i = 0; i < nImages; i++) {
            images.addElement(readImage(dis, nImages, nRows, nCols));



    public byte[][] readImage(DataInputStream dis, int nImages, int
nRows, int nCols) throws Exception {
        byte[][] imageByteArray = new byte[nRows][nCols];
        nBytes = nRows * nCols;
        buf = new byte[nBytes];, 0, nBytes);
        for (int x = 0; x < nRows; x++)  {
            for (int y = 0; y < nCols; y++) {
                imageByteArray[x][y] = buf[ x +  y * nRows];
        return imageByteArray;

    public byte[][] getImage(int i) {
        return (byte[][]) images.elementAt(i);

    public Object getPattern(int i) {
        return images.elementAt(i);

    public int getClass(int i) {
        return labels[i];

    public int nClasses() {
        return nClasses + 1;

    public int nPatterns() {
        return nImages;

    public ClassifiedDataset  emptyCopy() {
        // buggy - but probably not used!
        return this;


I have ommitted the setters and getters of the class
      variables in order to keep it short



<---------------  End of Java Code ---------------->

I already had a problem with the URLs and DataInputStream and
DataOutputStream variables so I declared within the methods rather than
global and I am not sure but I think SOAP can not handle the byte arrays
as properties of the JavaBean. Do you think there is a way of passing
this object through SOAP or is very complex and it can not serialize it?

Your help would be very much appreciated because this has been very
frustrating for me.

Thank you very much in advance for patience in reading this post and
your help.

Alexandros Panaretos

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message