You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by sa...@locus.apache.org on 2000/09/01 04:36:14 UTC

cvs commit: xml-soap/java/src/org/apache/soap Body.java

sanjiva     00/08/31 19:36:13

  Modified:    java/src/org/apache/soap Body.java
  Log:
  removed assumption that a body contains only things that are serializable.
  Now allows those as well as Element .. otherwise an exception is thrown
  (dunno how to marshall in that case).
  
  Revision  Changes    Path
  1.3       +29 -16    xml-soap/java/src/org/apache/soap/Body.java
  
  Index: Body.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Body.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Body.java	2000/05/30 10:23:50	1.2
  +++ Body.java	2000/09/01 02:36:13	1.3
  @@ -134,23 +134,36 @@
       {
         for (Enumeration e = bodyEntries.elements(); e.hasMoreElements();)
         {
  -        Bean bodyEntry = (Bean)e.nextElement();
  -
  -        if (Serializer.class.isAssignableFrom(bodyEntry.type))
  +	Object obj = e.nextElement();
  +	if (obj instanceof Bean)
  +        {
  +	  Bean bodyEntry = (Bean) obj;
  +	  
  +	  if (Serializer.class.isAssignableFrom(bodyEntry.type))
  +	  {
  +	    ((Serializer)bodyEntry.value).marshall(actualEncStyle,
  +						   bodyEntry.type,
  +						   bodyEntry.value,
  +						   null,
  +						   sink,
  +						   nsStack,
  +						   xjmr);
  +	  }
  +	  else
  +	  {
  +	    throw new IllegalArgumentException("Body entries must implement " +
  +					       "the Serializer interface.");
  +	  }
  +	}
  +	else if (obj instanceof Element)
           {
  -          ((Serializer)bodyEntry.value).marshall(actualEncStyle,
  -                                                 bodyEntry.type,
  -                                                 bodyEntry.value,
  -                                                 null,
  -                                                 sink,
  -                                                 nsStack,
  -                                                 xjmr);
  -        }
  -        else
  +	  Utils.marshallNode((Element)obj, sink);
  +	}
  +	else 
           {
  -          throw new IllegalArgumentException("Body entries must implement " +
  -                                             "the Serializer interface.");
  -        }
  +	  throw new IllegalArgumentException("Unknown type of body entry: '" +
  +					     obj.getClass () + "'");
  +	}
         }
       }
   
  @@ -203,4 +216,4 @@
   
       return sw.toString();
     }
  -}
  \ No newline at end of file
  +}