You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by "R. Mark Volkmann" <vo...@inlink.com> on 2000/10/03 03:39:15 UTC

possible problems in BeanSerializer

I'm relatively new to SOAP. I created an example server and client to
experiment and ran into problems passing Vectors.

Here's how I set the encoding style.

        call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

I made the following changes to BeanSerializer and my problems went away.
Can someone confirm whether these changes should really be made to
BeanSerializer?

In the marshall method after propType is set, add "if (propType == null)
continue;"

In the unmarshall method, replace the call to propWriteMethod.invoke with
the following in order to correctly pass Vectors.

    if (properties[0].getPropertyType() == Vector.class) {
        Object[] value = (Object[]) param.getValue();
        Vector v = new Vector();
        for (int i = 0; i < value.length; i++) {
            v.addElement(value[i]);
        }
        propWriteMethod.invoke(bean, new Object[] {v});
    } else {
        propWriteMethod.invoke(bean, new Object[]{param.getValue()});
    }

It's not clear to me why the unmarshall method in VectorSerializer isn't
used.