com.wingfoot.soap.encoding
Class BaseSerializer

java.lang.Object
  |
  +--com.wingfoot.soap.encoding.BaseSerializer

public class BaseSerializer
extends java.lang.Object

Converts primitive wrapper classes to XML. Conversely converts XML to primitive wrapper classes. Determines if a custom class is registered in an instance of TypeMappingRegistry. If it is, the appropriate instance of custom SerializerDeserializer is created and invoked.

Since:
0.90

Constructor Summary
BaseSerializer()
           
 
Method Summary
 java.lang.Object deserialize(com.wingfoot.soap.encoding.XmlParser parser, TypeMappingRegistry registry)
          Identical to the overloaded deserialize except that the datatype the XML element has to be deserialized to is not known and will be determined by the method.
 java.lang.Object deserialize(com.wingfoot.soap.encoding.XmlParser parser, TypeMappingRegistry registry, java.lang.String expectedNamespace, java.lang.String expectedType)
          Takes a element from a SOAP message and converts the return parameters, if present, to Java Objects.
 java.lang.String getSchemaInstance()
          Returns the schemaInstance
 void serialize(com.wingfoot.soap.encoding.XMLWriter xmlwriter, TypeMappingRegistry registry, java.lang.String parameterName, java.lang.Object objectToSerialize)
          Converts a parameter represented as Java objects to XML.
 void setSchemas(java.lang.String schema, java.lang.String schemaInstance, java.lang.String encodingStyle)
          Utility method to set the schema, schemaInstance and encodingStyle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSerializer

public BaseSerializer()
Method Detail

setSchemas

public void setSchemas(java.lang.String schema,
                       java.lang.String schemaInstance,
                       java.lang.String encodingStyle)
Utility method to set the schema, schemaInstance and encodingStyle. Usually set by the Envelope.
Parameters:
schema - String representing the schema.
schemaInstance - String representing the schemaInstance.
encodingStyle - String representing the encodingStyle.
Since:
0.90

getSchemaInstance

public java.lang.String getSchemaInstance()
Returns the schemaInstance
Returns:
the schemaInstance

serialize

public void serialize(com.wingfoot.soap.encoding.XMLWriter xmlwriter,
                      TypeMappingRegistry registry,
                      java.lang.String parameterName,
                      java.lang.Object objectToSerialize)
               throws java.lang.Exception
Converts a parameter represented as Java objects to XML. The parameter is specified using the setBody method in Envelope. Specifically, converts instances of Vector, Hashtable, Date and primitive wrapper (Byte, Short ...) and arrays to XML. If the Java object is not an instance of one of the above mentioned class, then the TypeMappingRegistry is accessed to determine the appropriate serializer class. Custom serializers (which implement SerializerDeserializer interface) call this method to serialize parameters.
Parameters:
xmlwriter - instance of XMLWriter to aid in writing XML.
registry - TypeMappingRegistry provided by the user in in the Envelope.
parameterName - the name of the parameter
objectToSerialize - the value of the parameter represented as an Object.
Throws:
java.lang.Exception - if any error occurs during writing XML or during serialization process.
Since:
0.90

deserialize

public java.lang.Object deserialize(com.wingfoot.soap.encoding.XmlParser parser,
                                    TypeMappingRegistry registry)
                             throws java.io.IOException,
                                    SOAPException,
                                    java.lang.Exception
Identical to the overloaded deserialize except that the datatype the XML element has to be deserialized to is not known and will be determined by the method.
Parameters:
registry - TypeMappingRegistry provided by the user in in the Envelope.
Throws:
java.io.IOException - if any error occurs in parsing the XML.
SOAPException - if any error occurs in deserialziing the parameter
java.lang.Exception - if any other error occurs.
Since:
0.90

deserialize

public java.lang.Object deserialize(com.wingfoot.soap.encoding.XmlParser parser,
                                    TypeMappingRegistry registry,
                                    java.lang.String expectedNamespace,
                                    java.lang.String expectedType)
                             throws java.io.IOException,
                                    SOAPException,
                                    java.lang.Exception
Takes a element from a SOAP message and converts the return parameters, if present, to Java Objects. The parameter name and the parameter value, represented as Java object, are stored using Envelope.setBody(String, Object) method. Custom deserializers (which implement SerializerDeserializer) call this method to convert the return parameters to first class java object.
Parameters:
registry - TypeMappingRegistry provided by the user in in the Envelope.
expectedNamespace -  
expectedType - this and expectedNamespace is required only if the type the parameter should be deserialized to is already known.
Returns:
the value of the parameter as a Java object.
Throws:
java.io.IOException - if any error occurs in parsing the XML.
SOAPException - if any error occurs in deserialziing the parameter
java.lang.Exception - if any other error occurs.
Since:
0.90


Copyright(c) Wingfoot Software (www.wingfoot.com). All Rights Reserved.

KXML is a XML parser by Lutris Technologies