I've already let out a few primal screams over this one! I cannot find ANY good references for how to use the Axis type mapping features in the form of Serializers and Deserializers external to what automatically happens when calling a web service.
Before I began implementing my service as a web service, I was using JAXB to (un)marshal rather painlessly back and forth from XML to Java. I decided that I had to abandon JAXB since the Serialization/Deserialization process associated with SOAP encoding wanted REAL JavaBeans, of which JAXB objects are not! (I could rant about JAXB being included in the JWSDP for hours!). I realized upon initial pass of the Axis impl of the whole SOAP encoding Serialization/Deserialization framework that I was about to tread some deep water. And I really did not want to hand this stuff off to junior developers to write clients to (un)marshal this way since it appeared so NON-TRIVIAL. I put an indepth analysis of this Serialization/Deserialization stuff aside and opted for Castor XML binding since it would (un)marshal to REAL JavaBeans in a fairly trivial manner. However, I figured that if the WSDL2Java process was going to dump some Axis specific Serialization/Deserialization references at the bottom of all my JavaBeans (can I prevent this?), and require me to include all the Axis jars with my JavaBeans anyway, I should probably take another stab at this process. I think (with about 40% confidence) that I should serialize in the following manner: ... MyClass myObject = myService.getMyObject(); QName qName = new QName( "http://dto.domain.com", "myRootElement" ); SerializationContext context = new SerializationContextImpl( new OutputStreamWriter( System.out ) ); /* // not sure if I need to do this or not ... TypeMappingRegistry registry = context.getTypeMappingRegistry(); TypeMapping typeMapping = (TypeMapping) registry.getTypeMapping( Constants.URI_LITERAL_ENC ); if ( typeMapping == null ) { typeMapping = (TypeMapping) registry.createTypeMapping(); registry.register( Constants.URI_LITERAL_ENC, typeMapping ); } typeMapping.register( MyClass.class, qName, new BeanSerializerFactory( MyClass.class, qName ), new BeanDeserializerFactory( MyClass.class, qName ) ); */ Serializer serializer = MyClass.getSerializer( "", MyClass.class, qName ); serializer.serialize( qName, null, myObject, context ); ... The last line throughs a NullPointerException. I have no idea what the org.xml.sax.Attributes are that this method expects or how to get them. Any references or ideas that anyone might have here would be greatly appreciated. If I can ever figure out what the heck is going on here I'm definitely going to write a paper on it from the dumb user perspective. - Lord knows we need it. All I see is questions about this stuff and no good answers. Cheers. Steve Maring _________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.