// Author: Jean-Marc Andre (jean-marc.andre@polymtl.ca)\r
//\r
//\r
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
+\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
\r
using System;\r
using System.Collections;\r
if (sf != null) {\r
if(_serverFaultExceptionField != null)\r
e = (Exception) _serverFaultExceptionField.GetValue(sf);\r
+#if TARGET_JVM \r
+ if (e == null && sf.ExceptionType != null)\r
+ {\r
+ try\r
+ {\r
+ Type te = Type.GetType(sf.ExceptionType);\r
+ if (te != null)\r
+ {\r
+ ConstructorInfo ce = te.GetConstructor(\r
+ BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance,\r
+ null, new Type[] {typeof(string)}, null);\r
+\r
+ if (ce != null)\r
+ {\r
+ e = (Exception) ce.Invoke(new object[] {sf.ExceptionMessage});\r
+ }\r
+ else\r
+ {\r
+ e = (Exception) Activator.CreateInstance(te);\r
+ }\r
+ }\r
+ }\r
+ catch\r
+ {\r
+ e = null;\r
+ }\r
+ }\r
+#endif\r
}\r
if (e == null)\r
e = new RemotingException (fault.FaultString);\r
headersList.Add(new Header("__Uri", uri));\r
headersList.Add(new Header("__MethodName", soapMessage.MethodName));\r
string typeNamespace, assemblyName;\r
- SoapServices.DecodeXmlNamespaceForClrTypeNamespace(soapMessage.XmlNameSpace, out typeNamespace, out assemblyName);\r
\r
- _serverType = RemotingServices.GetServerTypeForUri(uri);\r
+ if (!SoapServices.DecodeXmlNamespaceForClrTypeNamespace(soapMessage.XmlNameSpace, out typeNamespace, out assemblyName))\r
+ throw new RemotingException ("Could not decode SoapMessage");\r
+\r
+ // Note that we don't need to validate the type in\r
+ // this place because MethodCall will do it anyway.\r
+\r
+ if (assemblyName == null) // corlib\r
+ _serverType = Type.GetType (typeNamespace, true);\r
+ else\r
+ _serverType = Type.GetType (typeNamespace + ", " + assemblyName, true);\r
+\r
headersList.Add(new Header("__TypeName", _serverType.FullName, false));\r
\r
if (soapMessage.Headers != null) {\r
if (signature == null)\r
_methodCallInfo = _serverType.GetMethod(soapMessage.MethodName, bflags); \r
else\r
- _methodCallInfo = _serverType.GetMethod(soapMessage.MethodName, bflags, null, signature, null); \r
+ _methodCallInfo = _serverType.GetMethod(soapMessage.MethodName, bflags, null, signature, null);\r
+ \r
+ if (_methodCallInfo == null && (soapMessage.MethodName == "FieldSetter" || soapMessage.MethodName == "FieldGetter"))\r
+ _methodCallInfo = typeof(object).GetMethod (soapMessage.MethodName, bflags);\r
\r
// the *out* parameters aren't serialized\r
// have to add them here\r
}\r
else {\r
// an Exception was thrown while executing the function\r
- responseHeaders["__HttpStatusCode"] = "400";\r
+ responseHeaders["__HttpStatusCode"] = "500";\r
responseHeaders["__HttpReasonPhrase"] = "Bad Request";\r
// fill the transport headers\r
responseHeaders["Content-Type"] = "text/xml; charset=\"utf-8\"";\r
return sf;\r
}\r
\r
- internal void GetInfoFromMethodCallMessage(IMethodCallMessage mcm) {\r
+ internal void GetInfoFromMethodCallMessage (IMethodMessage mcm) {\r
_serverType = Type.GetType(mcm.TypeName, true);\r
- \r
- if (mcm.MethodSignature != null) \r
- _methodCallInfo = _serverType.GetMethod(mcm.MethodName, \r
- BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, \r
- null, (Type []) mcm.MethodSignature, null);\r
- else\r
- _methodCallInfo = _serverType.GetMethod(mcm.MethodName, \r
- BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);\r
-\r
+ _methodCallInfo = RemotingServices.GetMethodBaseFromMethodMessage (mcm) as MethodInfo;\r
_methodCallParameters = _methodCallInfo.GetParameters();\r
} \r
\r
\r
object GetNullValue (Type paramType)\r
{\r
+#if TARGET_JVM \r
+ if (paramType.IsEnum)\r
+ {\r
+ return Activator.CreateInstance(paramType);\r
+ }\r
+#endif\r
switch (Type.GetTypeCode (paramType))\r
{\r
case TypeCode.Boolean: return false;\r
case TypeCode.UInt16: return (ushort)0;\r
case TypeCode.UInt32: return (uint)0;\r
case TypeCode.UInt64: return (ulong)0;\r
- default: return null;\r
+ default: \r
+#if TARGET_JVM \r
+ if (paramType.IsValueType)\r
+ {\r
+ return Activator.CreateInstance(paramType);\r
+ }\r
+#endif \r
+ return null;\r
}\r
}\r
}\r
-}
+}\r