snichol 2002/10/18 08:49:13 Modified: java/docs/guide serializer.html Log: Add a code example of mapping types on the client. Revision Changes Path 1.7 +40 -7 xml-soap/java/docs/guide/serializer.html Index: serializer.html =================================================================== RCS file: /home/cvs/xml-soap/java/docs/guide/serializer.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- serializer.html 2 May 2002 20:49:55 -0000 1.6 +++ serializer.html 18 Oct 2002 15:49:13 -0000 1.7 @@ -32,17 +32,30 @@ the following Java types:</P> <UL> <LI>most Java primitive types, such as int, float, - boolean, byte, etc. and their corresponding - wrapper classes (i.e. java.lang.Integer, - java.lang.Boolean, etc.) - <LI>Java arrays + boolean, byte, but not char, and their corresponding + wrapper classes (e.g. java.lang.Integer, java.lang.Boolean) + <LI>Arrays of any type for which there is a serializer + <LI>Arrays of byte <LI>java.lang.String <LI>java.util.Date <LI>java.util.GregorianCalendar <LI>java.util.Vector <LI>java.util.Hashtable - <LI>java.util.Map (under Java editions in which - this is supported) + <LI>java.util.Dictionary + <LI>java.util.Stack + <LI>java.util.Map (under Java editions in which this is supported) + <LI>java.util.SortedMap (under Java editions in which this is supported) + <LI>java.util.HashMap (under Java editions in which this is supported) + <LI>java.util.TreeMap (under Java editions in which this is supported) + <LI>java.util.WeakHashMap (under Java editions in which this is supported) + <LI>java.util.Collection (under Java editions in which this is supported) + <LI>java.util.List (under Java editions in which this is supported) + <LI>java.util.Set (under Java editions in which this is supported) + <LI>java.util.SortedSet (under Java editions in which this is supported) + <LI>java.util.ArrayList (under Java editions in which this is supported) + <LI>java.util.LinkedList (under Java editions in which this is supported) + <LI>java.util.HashSet (under Java editions in which this is supported) + <LI>java.util.TreeSet (under Java editions in which this is supported) <LI>java.math.BigDecimal <LI>javax.mail.internet.MimeBodyPart <LI>java.io.InputStream @@ -109,7 +122,27 @@ mappings in multiple different clients or if you are also implementing the server-side as well, then the second method may save -you a little bit of coding.</P> +you a little bit of coding. The following code from +<code>GetAddress.java</code> in the addressbook sample shows +an example of mapping two classes that follow the Java Bean +pattern.</P> +<pre><code> + SOAPMappingRegistry smr = new SOAPMappingRegistry(); + BeanSerializer beanSer = new BeanSerializer(); + + // Map the types. + smr.mapTypes(Constants.NS_URI_SOAP_ENC, + new QName("urn:xml-soap-address-demo", "address"), + Address.class, beanSer, beanSer); + smr.mapTypes(Constants.NS_URI_SOAP_ENC, + new QName("urn:xml-soap-address-demo", "phone"), + PhoneNumber.class, beanSer, beanSer); + + // Build the call. + Call call = new Call(); + + call.setSOAPMappingRegistry(smr); +</code></pre> <H3>The Bean Serializer/Deserializer</H3> <P>In many cases, even if there is not a default type mapping for the object that you are
-- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>