org.ksoap2.serialization
Class SoapSerializationEnvelope

java.lang.Object
  extended by org.ksoap2.SoapEnvelope
      extended by org.ksoap2.serialization.SoapSerializationEnvelope

public class SoapSerializationEnvelope
extends SoapEnvelope

Author:
Stefan Haustein This class extends the SoapEnvelope with Soap Serialization functionality.

Field Summary
private static java.lang.String ANY_TYPE_LABEL
           
private static java.lang.String ARRAY_MAPPING_NAME
           
private static java.lang.String ARRAY_TYPE_LABEL
           
protected  java.util.Hashtable classToQName
          Map from Java class names to XML name and namespace pairs
(package private) static Marshal DEFAULT_MARSHAL
           
 boolean dotNet
          Set this variable to true for compatibility with what seems to be the default encoding for .Net-Services.
private static java.lang.String HREF_LABEL
           
private static java.lang.String ID_LABEL
           
(package private)  java.util.Hashtable idMap
           
 boolean implicitTypes
           
private static java.lang.String ITEM_LABEL
           
(package private)  java.util.Vector multiRef
           
private static java.lang.String NIL_LABEL
           
private static java.lang.String NULL_LABEL
           
 java.util.Hashtable properties
           
protected  java.util.Hashtable qNameToClass
          Map from XML qualified names to Java classes
private static java.lang.String ROOT_LABEL
           
private static java.lang.String TYPE_LABEL
           
(package private)  java.util.Vector types
           
 
Fields inherited from class org.ksoap2.SoapEnvelope
bodyIn, bodyOut, enc, ENC, ENC2001, encodingStyle, env, ENV, ENV2001, headerIn, headerOut, VER10, VER11, VER12, version, xsd, XSD, XSD1999, xsi, XSI, XSI1999
 
Constructor Summary
SoapSerializationEnvelope(int version)
           
 
Method Summary
 void addMapping(java.lang.String namespace, java.lang.String name, java.lang.Class clazz)
          Defines a direct mapping from a namespace and name to a java class (and vice versa)
 void addMapping(java.lang.String namespace, java.lang.String name, java.lang.Class clazz, Marshal marshal)
          Defines a direct mapping from a namespace and name to a java class (and vice versa), using the given marshal mechanism
 void addTemplate(SoapObject so)
          Adds a SoapObject to the class map.
private  int getIndex(java.lang.String value, int start, int dflt)
           
 java.lang.Object[] getInfo(java.lang.Object type, java.lang.Object instance)
          Returns a string array containing the namespace, name, id and Marshal object for the given java object.
 java.lang.Object getResponse()
          Response from the soap call.
 java.lang.Object getResult()
          Deprecated. Please use the getResponse going forward
 void parseBody(XmlPullParser parser)
           
 java.lang.Object read(XmlPullParser parser, java.lang.Object owner, int index, java.lang.String namespace, java.lang.String name, PropertyInfo expected)
          Builds an object from the XML stream.
 java.lang.Object readInstance(XmlPullParser parser, java.lang.String namespace, java.lang.String name, PropertyInfo expected)
          Returns a new object read from the given parser.
protected  void readSerializable(XmlPullParser parser, KvmSerializable obj)
           
protected  java.lang.Object readUnknown(XmlPullParser parser, java.lang.String typeNamespace, java.lang.String typeName)
          If the type of the object cannot be determined, and thus no Marshal class can handle the object, this method is called.
protected  void readVector(XmlPullParser parser, java.util.Vector v, PropertyInfo elementType)
           
 void writeBody(XmlSerializer writer)
          Serializes the request object to the given XmlSerliazer object
 void writeObjectBody(XmlSerializer writer, KvmSerializable obj)
          Writes the body of an KvmSerializable object.
protected  void writeProperty(XmlSerializer writer, java.lang.Object obj, PropertyInfo type)
           
protected  void writeVectorBody(XmlSerializer writer, java.util.Vector vector, PropertyInfo elementType)
           
 
Methods inherited from class org.ksoap2.SoapEnvelope
parse, parseHeader, setOutputSoapObject, stringToBoolean, write, writeHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_TYPE_LABEL

private static final java.lang.String ANY_TYPE_LABEL
See Also:
Constant Field Values

ARRAY_MAPPING_NAME

private static final java.lang.String ARRAY_MAPPING_NAME
See Also:
Constant Field Values

NULL_LABEL

private static final java.lang.String NULL_LABEL
See Also:
Constant Field Values

NIL_LABEL

private static final java.lang.String NIL_LABEL
See Also:
Constant Field Values

HREF_LABEL

private static final java.lang.String HREF_LABEL
See Also:
Constant Field Values

ID_LABEL

private static final java.lang.String ID_LABEL
See Also:
Constant Field Values

ROOT_LABEL

private static final java.lang.String ROOT_LABEL
See Also:
Constant Field Values

TYPE_LABEL

private static final java.lang.String TYPE_LABEL
See Also:
Constant Field Values

ITEM_LABEL

private static final java.lang.String ITEM_LABEL
See Also:
Constant Field Values

ARRAY_TYPE_LABEL

private static final java.lang.String ARRAY_TYPE_LABEL
See Also:
Constant Field Values

DEFAULT_MARSHAL

static final Marshal DEFAULT_MARSHAL

properties

public java.util.Hashtable properties

idMap

java.util.Hashtable idMap

multiRef

java.util.Vector multiRef

types

java.util.Vector types

implicitTypes

public boolean implicitTypes

dotNet

public boolean dotNet
Set this variable to true for compatibility with what seems to be the default encoding for .Net-Services. This feature is an extremely ugly hack. A much better option is to change the configuration of the .Net-Server to standard Soap Serialization!


qNameToClass

protected java.util.Hashtable qNameToClass
Map from XML qualified names to Java classes


classToQName

protected java.util.Hashtable classToQName
Map from Java class names to XML name and namespace pairs

Constructor Detail

SoapSerializationEnvelope

public SoapSerializationEnvelope(int version)
Method Detail

parseBody

public void parseBody(XmlPullParser parser)
               throws java.io.IOException,
                      XmlPullParserException
Overrides:
parseBody in class SoapEnvelope
Throws:
java.io.IOException
XmlPullParserException

readSerializable

protected void readSerializable(XmlPullParser parser,
                                KvmSerializable obj)
                         throws java.io.IOException,
                                XmlPullParserException
Throws:
java.io.IOException
XmlPullParserException

readUnknown

protected java.lang.Object readUnknown(XmlPullParser parser,
                                       java.lang.String typeNamespace,
                                       java.lang.String typeName)
                                throws java.io.IOException,
                                       XmlPullParserException
If the type of the object cannot be determined, and thus no Marshal class can handle the object, this method is called. It will build either a SoapPrimitive or a SoapObject

Parameters:
parser -
typeNamespace -
typeName -
Returns:
unknownObject wrapped as a SoapPrimitive or SoapObject
Throws:
java.io.IOException
XmlPullParserException

getIndex

private int getIndex(java.lang.String value,
                     int start,
                     int dflt)

readVector

protected void readVector(XmlPullParser parser,
                          java.util.Vector v,
                          PropertyInfo elementType)
                   throws java.io.IOException,
                          XmlPullParserException
Throws:
java.io.IOException
XmlPullParserException

read

public java.lang.Object read(XmlPullParser parser,
                             java.lang.Object owner,
                             int index,
                             java.lang.String namespace,
                             java.lang.String name,
                             PropertyInfo expected)
                      throws java.io.IOException,
                             XmlPullParserException
Builds an object from the XML stream. This method is public for usage in conjuction with Marshal subclasses. Precondition: On the start tag of the object or property, so href can be read.

Throws:
java.io.IOException
XmlPullParserException

readInstance

public java.lang.Object readInstance(XmlPullParser parser,
                                     java.lang.String namespace,
                                     java.lang.String name,
                                     PropertyInfo expected)
                              throws java.io.IOException,
                                     XmlPullParserException
Returns a new object read from the given parser. If no mapping is found, null is returned. This method is used by the SoapParser in order to convert the XML code to Java objects.

Throws:
java.io.IOException
XmlPullParserException

getInfo

public java.lang.Object[] getInfo(java.lang.Object type,
                                  java.lang.Object instance)
Returns a string array containing the namespace, name, id and Marshal object for the given java object. This method is used by the SoapWriter in order to map Java objects to the corresponding SOAP section five XML code.


addMapping

public void addMapping(java.lang.String namespace,
                       java.lang.String name,
                       java.lang.Class clazz,
                       Marshal marshal)
Defines a direct mapping from a namespace and name to a java class (and vice versa), using the given marshal mechanism


addMapping

public void addMapping(java.lang.String namespace,
                       java.lang.String name,
                       java.lang.Class clazz)
Defines a direct mapping from a namespace and name to a java class (and vice versa)


addTemplate

public void addTemplate(SoapObject so)
Adds a SoapObject to the class map. During parsing, objects of the given type (namespace/name) will be mapped to corresponding copies of the given SoapObject, maintaining the structure of the template.


getResponse

public java.lang.Object getResponse()
                             throws SoapFault
Response from the soap call. Pulls the object from the wrapper object and returns it.

Returns:
response from the soap call.
Throws:
SoapFault
Since:
2.0.3

getResult

public java.lang.Object getResult()
Deprecated. Please use the getResponse going forward

See Also:
getResponse()

writeBody

public void writeBody(XmlSerializer writer)
               throws java.io.IOException
Serializes the request object to the given XmlSerliazer object

Overrides:
writeBody in class SoapEnvelope
Parameters:
writer - XmlSerializer object to write the body into.
Throws:
java.io.IOException

writeObjectBody

public void writeObjectBody(XmlSerializer writer,
                            KvmSerializable obj)
                     throws java.io.IOException
Writes the body of an KvmSerializable object. This method is public for access from Marshal subclasses.

Throws:
java.io.IOException

writeProperty

protected void writeProperty(XmlSerializer writer,
                             java.lang.Object obj,
                             PropertyInfo type)
                      throws java.io.IOException
Throws:
java.io.IOException

writeVectorBody

protected void writeVectorBody(XmlSerializer writer,
                               java.util.Vector vector,
                               PropertyInfo elementType)
                        throws java.io.IOException
Throws:
java.io.IOException