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 Harmeet Bedi <hb...@hotmail.com> on 2000/06/29 19:29:37 UTC

Potential Problem with XMLParameterSerializer

I got a class cast exception when I used org.w3c.dom.Element as return value 
of a SOAP call.

The exception occurred in 
org.apache.soap.encoding.literalxml.XMLParameterSerializer

Here is the code (lines 85-91)
------------Start Originnal code------------------
Parameter param = (Parameter)src;   <-- got class cast exception here.
Class type = param.getType();
String name = param.getName();
if (type == Element.class)
{
    Element el = (Element)param.getValue();
------------End Originnal code---------------------

Changing this code to
---------Start Modified code------------------
Class type = javaType;
String name = (String)context;
if (type == Element.class)
{
    Element el = (Element)src;
---------Start Modified code------------------
Seems to fix it.

The <XMLParameterSerializer> code seems to be called from method <marshal> 
of class <org.apache.soap.encoding.soapenc.ParamterSerializer>
Here is the snapshot of code calling this.
----------------------------------
<lines [82-85]>
    Parameter param = (Parameter)src;
    Class type = param.getType();
    String name = param.getName();
    Object value = param.getValue();

<lines [94-100]>
      String declEncStyle = param.getEncodingStyleURI();
      String actualEncStyle = declEncStyle != null
                              ? declEncStyle
                              : inScopeEncStyle;
      Serializer s = xjmr.querySerializer(type, actualEncStyle);

      s.marshall(inScopeEncStyle, type, value, name, sink, nsStack, xjmr);
-------------------