+2003-05-27 Jean-Marc Andre <jean-marc.andre@polymtl.ca>
+ * SoapWriter:
+ bugs fixed
+ * SoapFormatter:
+ preparing for the remoting
+
2003-05-15 Jean-Marc Andre <jean-marc.andre@polymtl.ca>
* SoapFormatter:
New version of the SoapFormatter installed
</csc>
<copy file="../lib/System.Runtime.Serialization.Formatters.Soap.dll" tofile="Test/System.Runtime.Serialization.Formatters.Soap.dll"/>
<!--copy file="../lib/System.Xml.dll" tofile="Test/System.Xml.dll"/-->
- <nant basedir="Test" target="build"/>
+ <!--nant basedir="Test" target="build"/-->
</target>
<target name="test" depends="build">
\r
internal interface ISoapReader {\r
event ElementReadEventHandler ElementReadEvent;\r
+ ISoapMessage TopObject {\r
+ get; set;\r
+ }\r
}\r
}\r
using System;\r
using System.Collections;\r
using System.Reflection;\r
+using System.Runtime.Remoting;\r
using System.Runtime.Serialization;\r
\r
namespace System.Runtime.Serialization.Formatters.Soap {\r
return Int64.MaxValue ^ ++_nonId;\r
}\r
\r
+ // sometimes, the root object doesn't have an id\r
+ // An id has to be created to register the object\r
+ // with the ObjectManager\r
+ // If the root object is a SoapMessage. It has to be handle\r
+ // in a different way\r
public void RootElementRead(ISoapReader sender, ElementReadEventArgs e) {\r
ElementReadEventArgs args = e;\r
sender.ElementReadEvent -= new ElementReadEventHandler(RootElementRead);\r
_topObjectId = rootInfo._i;\r
}\r
args.RootElement = rootInfo;\r
- ElementRead(sender, args);\r
+ if(rootInfo._type == typeof(SoapMessage)) RPCHandler(args);\r
+ else ElementRead(sender, args);\r
\r
+ }\r
+ \r
+ private void RPCHandler(ElementReadEventArgs e) {\r
+ ElementInfo rpcInfo = e.RootElement;\r
+ SoapMessage soapMessage = (SoapMessage) rpcInfo._value;\r
+ \r
+ \r
+ // register the SoapMessage\r
+ _manager.RegisterObject(soapMessage, 1);\r
+ \r
+ int count = e.FieldsInfo.Count;\r
+ soapMessage.ParamNames = new string[count];\r
+ soapMessage.ParamTypes = new Type[count];\r
+ soapMessage.ParamValues = new object[count];\r
+ \r
+ long paramValuesId = GetNextId();\r
+ _manager.RegisterObject(soapMessage.ParamValues, paramValuesId);\r
+ soapMessage.ParamNames = FixupArrayItems(paramValuesId, e.FieldsInfo);\r
+ \r
+ \r
+ \r
}\r
\r
public void ElementRead(ISoapReader sender, ElementReadEventArgs e) {\r
_manager.RegisterObject(objRoot, rootInfo._i, serializationInfo);\r
\r
if(objRoot.GetType().IsArray){\r
- FixupArrayItems(rootInfo._i, rootInfo._arrayDims, e.FieldsInfo);\r
+ FixupArrayItems(rootInfo._i, e.FieldsInfo);\r
}else {\r
FixupFields(rootInfo._i, objRoot, rootInfo._type, e.FieldsInfo, serializationInfo);\r
}\r
memberInfo.SetValue(objectToBeFixed, objValue, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, null);\r
}\r
_manager.RegisterObject(objValue, fieldInfo._i, null, objectToBeFixedId, memberInfo);\r
-// _manager.DoFixups();\r
break;\r
case ElementType.Nothing:\r
if(serializationInfo != null) {\r
}\r
}\r
\r
- private void FixupArrayItems(long arrayToBeFixedId, int[] arrayDims, ICollection arrayItemsInfo) {\r
+ private String[] FixupArrayItems(long arrayToBeFixedId, ICollection arrayItemsInfo) {\r
+ ArrayList arrayNames = new ArrayList(arrayItemsInfo.Count);\r
System.Array array = (System.Array) _manager.GetObject(arrayToBeFixedId);\r
- if(array.Length == 0) return;\r
+// if(array.Length == 0) return null;\r
int[] indices = new int[array.Rank];\r
for(int dim=array.Rank-1; dim>=0; dim--){\r
indices[dim] = array.GetLowerBound(dim);\r
IEnumerator iEnum = arrayItemsInfo.GetEnumerator();\r
while(iEnum.MoveNext()) {\r
ElementInfo arrayItemInfo = (ElementInfo) iEnum.Current;\r
+ arrayNames.Add(arrayItemInfo._name);\r
specificElementType = (arrayItemInfo._type != null) ? arrayItemInfo._type : arrayElementType;\r
switch(arrayItemInfo._elementType) {\r
case ElementType.Href:\r
}\r
bool end = FillIndices(array, ref indices);\r
}\r
- \r
+ string[] aNames = (string[]) arrayNames.ToArray(typeof(string));\r
+ return aNames;\r
}\r
\r
private bool FillIndices(System.Array array, ref int[] indices) {\r
}\r
}\r
ISerializable ser = objCurrent as ISerializable;\r
- if(ser != null){\r
+ if(ser != null && _serializationInfo.MemberCount == 0){\r
ser.GetObjectData(_serializationInfo, _context);\r
}\r
if(_serializationInfo.MemberCount == 0) {\r
\r
using System;\r
using System.IO;\r
+using System.Reflection;\r
+using System.Runtime.Remoting;\r
using System.Runtime.Serialization;\r
using System.Runtime.Remoting.Messaging;\r
using System.Xml.Serialization;\r
\r
\r
namespace System.Runtime.Serialization.Formatters.Soap {\r
- public class SoapFormatterT: IRemotingFormatter, IFormatter {\r
+ enum RemMessageType {\r
+ MethodCall, MethodResponse, ServerFault, NotRecognize\r
+ }\r
+ \r
+ public class SoapFormatter: IRemotingFormatter, IFormatter {\r
private ObjectWriter _objWriter;\r
private SoapWriter _soapWriter;\r
private SerializationBinder _binder;\r
private StreamingContext _context;\r
private ISurrogateSelector _selector;\r
+ private ISoapMessage _topObject;\r
\r
- public SoapFormatterT() {\r
+ public SoapFormatter() {\r
+ \r
}\r
\r
- public SoapFormatterT(ISurrogateSelector selector, StreamingContext context):this() {\r
+ public SoapFormatter(ISurrogateSelector selector, StreamingContext context):this() {\r
_selector = selector;\r
_context = context;\r
}\r
\r
- ~SoapFormatterT() {\r
+ ~SoapFormatter() {\r
}\r
\r
public object Deserialize(Stream serializationStream) {\r
public object Deserialize(Stream serializationStream, HeaderHandler handler) {\r
SoapParser parser = new SoapParser(serializationStream);\r
SoapReader soapReader = new SoapReader(parser);\r
+ \r
+ \r
+ if(_topObject != null) soapReader.TopObject = _topObject;\r
ObjectReader reader = new ObjectReader(_selector, _context, soapReader);\r
parser.Run();\r
- return reader.TopObject;\r
+ object objReturn = reader.TopObject;\r
+ if(objReturn is SoapMessage) FixupSoapMessage((SoapMessage)objReturn);\r
+ return objReturn;\r
}\r
\r
\r
+ \r
public void Serialize(Stream serializationStream, object graph) {\r
Serialize(serializationStream, graph, null);\r
}\r
}\r
}\r
\r
+ public ISoapMessage TopObject {\r
+ get {\r
+ return _topObject;\r
+ }\r
+ set {\r
+ _topObject = value;\r
+ }\r
+ }\r
+ \r
+ \r
+ //private methods\r
+ \r
+ // finish the work on the SoapMessage\r
+ // fill the SoapMessage.ParamName array\r
+ // fill the SoapMessage.ParamType array\r
+ // convert the SoapMessage.ParamValue array items\r
+ // to the right type if needed\r
+ private void FixupSoapMessage(ISoapMessage msg) {\r
+ string typeNamespace, assemblyName;\r
+ \r
+ SoapServices.DecodeXmlNamespaceForClrTypeNamespace(msg.XmlNameSpace, out typeNamespace, out assemblyName);\r
+ try{\r
+ RemMessageType messageType;\r
+ MethodInfo mi = GetMethodInfo(msg.MethodName, msg.XmlNameSpace, out messageType);\r
+ \r
+ FormatterConverter conv = new FormatterConverter();\r
+ switch(messageType) {\r
+ case RemMessageType.MethodCall:\r
+ int nbOutParams = 0;\r
+ ParameterInfo[] paramInfo = mi.GetParameters();\r
+ foreach(ParameterInfo param in paramInfo) {\r
+ // The *out* parameters aren't serialized\r
+ if(!param.IsOut) {\r
+ msg.ParamNames[param.Position - nbOutParams] = param.Name;\r
+ msg.ParamTypes[param.Position - nbOutParams] = param.ParameterType;\r
+ if(msg.ParamValues[param.Position - nbOutParams] is IConvertible) msg.ParamValues[param.Position - nbOutParams] = conv.Convert(msg.ParamValues[param.Position - nbOutParams], param.ParameterType);\r
+ }\r
+ else nbOutParams++;\r
+ }\r
+ break;\r
+ case RemMessageType.MethodResponse:\r
+ int offset = 0;\r
+ if(mi.ReturnType != typeof(void)) {\r
+ msg.ParamNames[0] = "return";\r
+ msg.ParamTypes[0] = mi.ReturnType;\r
+ if(msg.ParamValues[0] is IConvertible) msg.ParamValues[0] = Convert.ChangeType(msg.ParamValues[0], mi.ReturnType);\r
+ offset++;\r
+ }\r
+ paramInfo = mi.GetParameters();\r
+ foreach(ParameterInfo param in paramInfo) {\r
+ // The *out* parameters\r
+ if(param.IsOut) {\r
+ msg.ParamNames[offset] = param.Name;\r
+ //msg.ParamTypes[offset] = param.ParameterType;\r
+ //if(msg.ParamValues[offset] is IConvertible) msg.ParamValues[param.Position] = conv.Convert(msg.ParamValues[offset], param.ParameterType);\r
+ offset++;\r
+ }\r
+ }\r
+ break;\r
+ case RemMessageType.ServerFault:\r
+ break;\r
+ case RemMessageType.NotRecognize:\r
+ throw new SerializationException(String.Format("Can't find a method with name {0} for {1}", msg.MethodName, msg.XmlNameSpace));\r
+ \r
+ }\r
+ }\r
+ catch(Exception e) {\r
+ // Last chance\r
+ // maybe it is a SoapFault object\r
+ if(msg.MethodName != "Fault") throw new SerializationException("Don't understand the response from the server");\r
+ else return;\r
+ }\r
+ \r
+ }\r
+ \r
+ // Get the MethodInfo\r
+ internal static MethodInfo GetMethodInfo(string methodName, string xmlNamespace, out RemMessageType messageType) {\r
+ string typeNamespace, assemblyName;\r
+ bool result = SoapServices.DecodeXmlNamespaceForClrTypeNamespace(xmlNamespace, out typeNamespace, out assemblyName);\r
+ return GetMethodInfo(methodName, typeNamespace, assemblyName, out messageType);\r
+ }\r
+ \r
+ internal static MethodInfo GetMethodInfo(string methodName, string typeName, string assemblyName, out RemMessageType messageType) {\r
+ Type type = GetType(typeName, assemblyName);\r
+ MethodInfo mi = null;\r
+ messageType = RemMessageType.MethodCall;\r
+ if(type != null) {\r
+ mi = type.GetMethod(methodName);\r
+ \r
+ if(mi == null) {\r
+ int index = methodName.LastIndexOf("Response");\r
+ string methodResponseName = methodName.Remove(index, methodName.Length - index);\r
+ mi = type.GetMethod(methodResponseName);\r
+ if(mi == null) {\r
+ if(methodName != "Fault") messageType = RemMessageType.NotRecognize;\r
+ else messageType = RemMessageType.ServerFault;\r
+ } \r
+ messageType = RemMessageType.MethodResponse;\r
+ }\r
+ }\r
+ return mi;\r
+ }\r
+ \r
+ internal static Type GetType(string typeName, string assemblyName) {\r
+ Type type = Type.GetType(typeName);\r
+ if(type == null) {\r
+ AssemblyName assName = new AssemblyName();\r
+ assName.Name = assemblyName;\r
+ Assembly ass = Assembly.Load(assName);\r
+ type = FormatterServices.GetTypeFromAssembly(ass, typeName);\r
+ if(type == null) throw new SerializationException(String.Format("Can't find type {0} in assembly {1}", typeName, assemblyName));\r
+ }\r
+ return type;\r
+ }\r
+ \r
}\r
}\r
<File name=".\SoapReader.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
<File name=".\SoapTypeMapper.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
<File name=".\SoapTypeMapping.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\ObjectManager.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
+ <File name=".\ObjectManager.cs" subtype="Code" buildaction="Nothing" dependson="" data="" />\r
</Contents>\r
<References />\r
<DeploymentInformation target="" script="" strategy="File" />\r
<Configuration runwithwarnings="True" name="Debug">\r
<CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="0" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
<Execution commandlineparameters="" consolepause="False" />\r
- <Output directory="..\" assembly="Soap" />\r
+ <Output directory="..\..\..\..\..\..\..\..\Jim\SharpDevelop Projects\MySinks" assembly="Soap" />\r
</Configuration>\r
<Configurations active="Debug">\r
<Configuration runwithwarnings="True" name="Debug">\r
<CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="0" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
<Execution commandlineparameters="" consolepause="False" />\r
- <Output directory="..\" assembly="Soap" />\r
+ <Output directory="..\..\..\..\..\..\..\..\Jim\SharpDevelop Projects\MySinks" assembly="Soap" />\r
</Configuration>\r
<Configuration runwithwarnings="True" name="Release">\r
<CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="0" includedebuginformation="False" optimize="True" unsafecodeallowed="True" generateoverflowchecks="False" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
namespace System.Runtime.Serialization.Formatters.Soap {\r
internal class SoapReader: ISoapReader {\r
public event ElementReadEventHandler ElementReadEvent;\r
+ private ISoapMessage _soapMessage;\r
+ private ISoapParser _parser;\r
+ \r
+ public ISoapMessage TopObject {\r
+ get { return _soapMessage; }\r
+ set { \r
+ _soapMessage = value;\r
+ \r
+ // the first element of the SOAP stream\r
+ // should be a SOAP RPC\r
+ _parser.SoapElementReadEvent -= new SoapElementReadEventHandler(SoapElementRead);\r
+ _parser.SoapElementReadEvent += new SoapElementReadEventHandler(SoapRPCElementRead);\r
+ }\r
+ }\r
\r
public SoapReader(ISoapParser parser) {\r
// register the SoapElementReadEvent handler\r
- parser.SoapElementReadEvent += new SoapElementReadEventHandler(SoapElementRead);\r
+ _parser = parser;\r
+ _parser.SoapElementReadEvent += new SoapElementReadEventHandler(SoapElementRead);\r
+ }\r
+ \r
+ public void SoapRPCElementRead(ISoapParser sender, SoapElementReadEventArgs e) {\r
+ _parser.SoapElementReadEvent += new SoapElementReadEventHandler(SoapElementRead);\r
+ _parser.SoapElementReadEvent -= new SoapElementReadEventHandler(SoapRPCElementRead);\r
+ \r
+ Queue elementQueue = e.ElementQueue;\r
+ Queue elementInfoQueue = new Queue();\r
+ SoapSerializationEntry root = (SoapSerializationEntry) elementQueue.Dequeue();\r
+ \r
+ // fill the SoapMessage members\r
+ // MethodName\r
+ //elementInfoQueue.Enqueue(new ElementInfo(typeof(string), "MethodName", rpcInfo.elementName, ElementType.Nothing, 0, 0);\r
+ _soapMessage.MethodName = root.elementName;\r
+ \r
+ // XmlNamespace\r
+ //elementInfoQueue.Enqueue(new ElementInfo(typeof(string), "XmlNamespace", rpcInfo.elementNamespace, ElementType.Nothing, 0, 0);\r
+ _soapMessage.XmlNameSpace = root.elementNamespace;\r
+ \r
+ // the root element is a SoapMessage\r
+ ElementInfo rpcInfo = new ElementInfo(typeof(SoapMessage), String.Empty, _soapMessage, ElementType.Id, 1, null);\r
+ \r
+ //todo: headers\r
+ \r
+ // add the function parameters to the queue\r
+ SoapSerializationEntry field;\r
+ ElementInfo fieldElementInfo;\r
+ while(elementQueue.Count > 0){\r
+ field = (SoapSerializationEntry) elementQueue.Dequeue();\r
+ fieldElementInfo = GetElementInfo(field);\r
+ elementInfoQueue.Enqueue(fieldElementInfo);\r
+ }\r
+\r
+ // raise the ElementReadEvent\r
+ ElementReadEvent(this,new ElementReadEventArgs(rpcInfo, elementInfoQueue));\r
+ \r
+ \r
}\r
\r
// called when SoapElementReadEvent is raized by the SoapParser object\r
\r
ElementInfo rootInfo = GetElementInfo(root);\r
SoapSerializationEntry field;\r
+ ElementInfo fieldElementInfo;\r
while(elementQueue.Count > 0){\r
field = (SoapSerializationEntry) elementQueue.Dequeue();\r
- elementInfoQueue.Enqueue(GetElementInfo(field));\r
+ fieldElementInfo = GetElementInfo(field);\r
+ elementInfoQueue.Enqueue(fieldElementInfo);\r
}\r
\r
// raise the ElementReadEvent\r
rtnObject = Type.GetType(typeNamespace+"."+mapping.TypeName);\r
\r
if(rtnObject == null) {\r
- Assembly ass =Assembly.Load(typeNamespace);\r
+// AssemblyName assName = new AssemblyName()\r
+// assName.FullName = asse\r
+ Assembly ass =Assembly.Load(assemblyName);\r
if(ass != null) {\r
rtnObject = ass.GetType(typeNamespace+"."+mapping.TypeName, true);\r
}\r
mapping = new SoapTypeMapping(typeof(string), "string", true, false, false, true);\r
_mappingTable.Add(typeof(string),mapping);\r
_invertMappingTable.Add(mapping, typeof(string));\r
+ mapping = new SoapTypeMapping(typeof(string), "string", "http://www.w3.org/2001/XMLSchema", true, false, false, true);\r
+ _invertMappingTable.Add(mapping, typeof(string));\r
\r
// the primitive type "System.Int16"\r
mapping = new SoapTypeMapping(typeof(short), "short", "http://www.w3.org/2001/XMLSchema", true, true, true, false);\r
_mappingTable.Add(typeof(object), mapping);\r
_invertMappingTable.Add(mapping, typeof(object));\r
\r
+ mapping = new SoapTypeMapping(typeof(System.Runtime.Serialization.Formatters.SoapFault), "Fault", "http://schemas.xmlsoap.org/soap/envelope/", false, false, false, true);\r
+ _mappingTable.Add(typeof(System.Runtime.Serialization.Formatters.SoapFault), mapping);\r
+ _invertMappingTable.Add(mapping, typeof(System.Runtime.Serialization.Formatters.SoapFault));\r
+ \r
\r
}\r
}\r
// todo: manage the encoding\r
_xmlWriter = new XmlTextWriter(outStream, null);\r
_xmlWriter.Formatting = Formatting.Indented;\r
+ _xmlWriter.Indentation = 2;\r
// _xmlWriter.WriteComment("My serialization function");\r
_format = new CultureInfo("en-US");\r
}\r
}\r
\r
private SoapSerializationEntry FillEntry(Type defaultObjectType, object objValue) {\r
-// SoapTypeMapping mapping = GetTagInfo((objValue != null)?objValue.GetType():defaultObjectType);\r
SoapTypeMapping mapping = GetTagInfo((objValue != null && defaultObjectType == typeof(object))?objValue.GetType():defaultObjectType);\r
\r
SoapSerializationEntry soapEntry = new SoapSerializationEntry();\r
soapEntry.elementType = ElementType.Href;\r
soapEntry.i = (long) _objectIds[objValue];\r
soapEntry.WriteFullEndElement = false;\r
+ soapEntry.SpecifyEncoding = false;\r
}\r
else if(!mapping.CanBeValue){\r
id = GetNextId();\r
_objectQueue.Enqueue(new EnqueuedObject(objValue, id));\r
_objectRefs[id] = objValue;\r
_objectIds[objValue] = id;\r
+ soapEntry.SpecifyEncoding = false;\r
} \r
else if(mapping.NeedId){ \r
id = GetNextId();\r
}\r
\r
public void WriteFields(SerializationInfo info) {\r
- // SoapTypeMapping mapping;\r
ICollection attributeList;\r
SoapSerializationEntry soapEntry;\r
\r
foreach(SerializationEntry entry in info){\r
- // mapping = GetTagInfo(entry.ObjectType);\r
soapEntry = FillEntry(entry.ObjectType, entry.Value);\r
\r
\r
}\r
\r
private void WriteSoapRPC(ISoapMessage soapMsg) {\r
- throw new NotImplementedException();\r
\r
_xmlWriter.WriteStartElement("i2", soapMsg.MethodName, soapMsg.XmlNameSpace);\r
_xmlWriter.WriteAttributeString("id", null, "ref-"+_currentObjectId);\r
SoapServices.DecodeXmlNamespaceForClrTypeNamespace(soapMsg.XmlNameSpace, out typeNamespace, out assemblyName);\r
\r
Type objType = Type.GetType(typeNamespace);\r
- MethodInfo mthInfo = objType.GetMethod(soapMsg.MethodName);\r
- \r
- for(int i=0; i<soapMsg.ParamNames.Length; i++){\r
- info.AddValue(soapMsg.ParamNames[i], soapMsg.ParamValues[i], soapMsg.ParamTypes[i]);\r
+ if(soapMsg.ParamNames != null) {\r
+ for(int i=0; i<soapMsg.ParamNames.Length; i++){\r
+ string name = soapMsg.ParamNames[i];\r
+ object objValue = soapMsg.ParamValues[i];\r
+ Type type = soapMsg.ParamTypes[i];\r
+ info.AddValue(name, objValue, type);\r
+ }\r
+ WriteFields(info);\r
}\r
- WriteFields(info);\r
+ \r
\r
_xmlWriter.WriteEndElement();\r
\r
// project created on 09/05/2003 at 18:07\r
using System;\r
using System.Collections;\r
+using System.Runtime.Remoting;\r
using System.Runtime.Remoting.Messaging;\r
using System.Runtime.Serialization;\r
+using System.Runtime.Serialization.Formatters;\r
using System.Runtime.Serialization.Formatters.Soap;\r
using System.IO;\r
using NUnit.Framework;\r
[TestFixture]\r
public class SoapFormatterTest\r
{\r
- private SoapFormatterT _soapFormatter;\r
+ private SoapFormatter _soapFormatter;\r
+ private SoapFormatter _soapFormatterDeserializer;\r
+ private RemotingSurrogateSelector _surrogate;\r
\r
private object Serialize(object objGraph) {\r
MemoryStream stream = new MemoryStream();\r
+ Assertion.Assert(objGraph != null);\r
+ Assertion.Assert(stream != null);\r
+ _soapFormatter.SurrogateSelector = _surrogate;\r
_soapFormatter.Serialize(stream, objGraph);\r
\r
- \r
+ stream.Position = 0;\r
+ StreamReader r = new StreamReader(stream);\r
+ Console.WriteLine(r.ReadToEnd());\r
stream.Position = 0;\r
\r
- object objReturn = _soapFormatter.Deserialize(stream);\r
+ object objReturn = _soapFormatterDeserializer.Deserialize(stream);\r
Assertion.Assert(objReturn != null);\r
Assertion.AssertEquals("#Tests "+objGraph.GetType(), objGraph.GetType(), objReturn.GetType());\r
stream = new MemoryStream();\r
_soapFormatter.Serialize(stream, objReturn);\r
stream.Position = 0;\r
- StreamReader r = new StreamReader(stream);\r
- Console.WriteLine(r.ReadToEnd());\r
+// StreamReader r = new StreamReader(stream);\r
+// Console.WriteLine(r.ReadToEnd());\r
\r
return objReturn;\r
}\r
\r
[SetUp]\r
public void GetReady() {\r
- _soapFormatter = new SoapFormatterT(new RemotingSurrogateSelector(), new StreamingContext(StreamingContextStates.All));\r
+ StreamingContext context = new StreamingContext(StreamingContextStates.All);\r
+ _surrogate = new RemotingSurrogateSelector();\r
+ _soapFormatter = new SoapFormatter(_surrogate, context);\r
+ _soapFormatterDeserializer = new SoapFormatter(null, context);\r
}\r
\r
[TearDown]\r
objReturn = Serialize("");\r
objReturn = Serialize("hello world!");\r
Assertion.AssertEquals("#string", "hello world!", objReturn);\r
+ SoapMessage soapMsg = new SoapMessage();\r
+ soapMsg.Headers = new Header[0];\r
+ soapMsg.MethodName = "Equals";\r
+ soapMsg.ParamNames = new String[0];\r
+ soapMsg.ParamTypes = new Type[0];\r
+ soapMsg.ParamValues = new object[0];\r
+ soapMsg.XmlNameSpace = SoapServices.CodeXmlNamespaceForClrTypeNamespace("String", "System");\r
+ _soapFormatterDeserializer.TopObject = new SoapMessage();\r
+ objReturn = Serialize(soapMsg);\r
+ _soapFormatterDeserializer.TopObject = null;\r
SimpleObject obj = new SimpleObject("simple object", 1);\r
objReturn = Serialize(obj);\r
Assertion.AssertEquals("#SimpleObject", obj, objReturn);\r
</References>\r
<DeploymentInformation target="" script="" strategy="File" />\r
<Configuration runwithwarnings="True" name="Debug">\r
- <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="4" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
+ <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="0" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
<Execution commandlineparameters="" consolepause="True" />\r
<Output directory="..\" assembly="Test" />\r
</Configuration>\r
<Configurations active="Debug">\r
<Configuration runwithwarnings="True" name="Debug">\r
- <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="4" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
+ <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="0" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />\r
<Execution commandlineparameters="" consolepause="True" />\r
<Output directory="..\" assembly="Test" />\r
</Configuration>\r