[Mono-bugs] [Bug 76454][Wis] Changed - Problems with
MarshalByRefObject remoting, channels and webservices.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Oct 16 16:45:41 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by carlos at applianz.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76454
--- shadow/76454 2005-10-16 16:28:31.000000000 -0400
+++ shadow/76454.tmp.9190 2005-10-16 16:45:41.000000000 -0400
@@ -1,14 +1,14 @@
Bug#: 76454
Product: Mono: Class Libraries
Version: 1.1
-OS:
+OS: unknown
OS Details: gentoo 64bit
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Wishlist
Component: System
AssignedTo: mono-bugs at ximian.com
ReportedBy: carlos at applianz.com
QAContact: mono-bugs at ximian.com
TargetMilestone: ---
@@ -48,6 +48,296 @@
(System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg,
System.Exception exc, System.Object[] out_args)
I tried registering a channel without checking if one is registered and the
call just gave me an exception saying a channel was already registered.
+
+------- Additional Comments From carlos at applianz.com 2005-10-16 16:45 -------
+I have created an example that works on windows ms.net but not on mono
+on Linux, the longer exception is copied below as well as the code,
+also this example fails on the first call.
+
+Exception:
+=====================================================
+<?xml version="1.0" encoding="utf-8"?>
+<string
+xmlns="http://tempuri.org/">System.Runtime.Remoting.RemotingException:
+Cannot create
+ channel sink to connect to URL
+8b060dc9_4b4a_4907_aeba_855302d7b6e9/-83389294_4.rem. An
+ appropriate channel has probably not been registered.
+
+Server stack trace:
+in <0x000da>
+System.Runtime.Remoting.RemotingServices:GetClientChannelSinkChain (
+ System.String url, System.Object channelData, System.String
+objectUri)
+in <0x000cb>
+System.Runtime.Remoting.RemotingServices:GetOrCreateClientIdentity (
+ System.Runtime.Remoting.ObjRef objRef, System.Type proxyType,
+System.Object clientProxy)
+in <0x00028> System.Runtime.Remoting.RemotingServices:GetRemoteObject (
+ System.Runtime.Remoting.ObjRef objRef, System.Type proxyType)
+in <0x00075>
+System.Runtime.Remoting.RemotingServices:GetProxyForRemoteObject (
+ System.Runtime.Remoting.ObjRef objref, System.Type classToProxy)
+in <0x0014f> System.Runtime.Remoting.RemotingServices:Unmarshal (
+ System.Runtime.Remoting.ObjRef objref, Boolean fRefine)
+in <0x00019> System.Runtime.Remoting.RemotingServices:Unmarshal (
+ System.Runtime.Remoting.ObjRef objref)
+in <0x0002a> System.Runtime.Remoting.ObjRef:GetRealObject
+(StreamingContext sc)
+in <0x00548> System.Runtime.Serialization.ObjectRecord:LoadData (
+ System.Runtime.Serialization.ObjectManager manager,
+ISurrogateSelector selector,
+ StreamingContext context)
+in <0x0017b> System.Runtime.Serialization.ObjectManager:DoFixups ()
+in <0x00019>
+System.Runtime.Serialization.Formatters.Soap.SoapReader:get_TopObject ()
+in <0x00471>
+System.Runtime.Serialization.Formatters.Soap.SoapReader:Deserialize (
+ System.IO.Stream inStream, ISoapMessage soapMessage)
+in <0x000c3>
+System.Runtime.Serialization.Formatters.Soap.SoapFormatter:Deserialize (
+ System.IO.Stream serializationStream,
+System.Runtime.Remoting.Messaging.HeaderHandler
+ handler)
+in <0x00026>
+System.Runtime.Serialization.Formatters.Soap.SoapFormatter:Deserialize (
+ System.IO.Stream serializationStream)
+in <0x00247>
+System.Runtime.Remoting.Channels.SoapServerFormatterSink:ProcessMessage (
+ IServerChannelSinkStack sinkStack, IMessage requestMsg,
+ITransportHeaders requestHeaders,
+ System.IO.Stream requestStream, IMessage responseMsg,
+ITransportHeaders responseHeaders,
+ System.IO.Stream responseStream)
+
+Exception rethrown at [0]:
+
+in <0x009a8> System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke (
+ System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg,
+System.Exception exc,
+ System.Object[] out_args)</string>
+=====================================================
+
+Shared Library:
+=====================================================
+using System;
+
+namespace RemInterface
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ public interface ITest
+ {
+ String Str{get;set;}
+ IClientTest ClientTest{get;set;}
+ }
+ //was an interface before thats why its called IClientTest, then I
+got lazy.
+ public class IClientTest:System.MarshalByRefObject
+ {
+ private String str = null;
+ public String Str
+ {
+ get
+ {
+ Console.WriteLine("Client Str value retrieved");
+ return str;
+ }
+ set
+ {
+ Console.WriteLine("Client Str value set");
+ str = value;
+ }
+ }
+
+ }
+}
+
+=====================================================
+
+Remoting Server code:
+=====================================================
+using System;
+using System.Runtime;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Http;
+using System.Collections;
+
+namespace RemServer
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ IDictionary props = new Hashtable();
+ props["typeFilterLevel"] = "Full";
+ SoapServerFormatterSinkProvider formatterProvider = new
+SoapServerFormatterSinkProvider(props,null);
+ SoapClientFormatterSinkProvider clientProv = new
+SoapClientFormatterSinkProvider();
+ props["port"] = 5050;
+ HttpChannel channel = new
+HttpChannel(props,clientProv,formatterProvider);
+ ChannelServices.RegisterChannel(channel);
+ Test t = new Test();
+ t.Str = "initialized";
+ RemotingServices.Marshal(t,"test");
+ Console.WriteLine("Hit enter to end");
+ Console.ReadLine();
+
+ }
+ }
+ public class Test: System.MarshalByRefObject,RemInterface.ITest
+ {
+ private RemInterface.IClientTest client;
+ private String str = null;
+ public String Str
+ {
+ get
+ {
+ Console.WriteLine("Str value retrieved");
+ return str;
+ }
+ set
+ {Console.WriteLine("Str value set");
+ str = value;
+ }
+ }
+ public RemInterface.IClientTest ClientTest
+ {
+ get
+ {
+ Console.WriteLine("Client test retrieve.");
+ return client;
+ }
+ set
+ {
+ Console.WriteLine("Client test set");
+ client = value;
+ }
+ }
+ }
+}
+
+=====================================================
+
+Remoting Client (webservice)
+=====================================================
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Web;
+using System.Web.Services;
+
+
+using System.Runtime;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Http;
+
+
+namespace WebService2
+{
+ /// <summary>
+ /// Summary description for Service1.
+ /// </summary>
+ public class Service1 : System.Web.Services.WebService
+ {
+ public Service1()
+ {
+ //CODEGEN: This call is required by the ASP.NET Web Services Designer
+ InitializeComponent();
+ }
+
+ #region Component Designer generated code
+
+ //Required by the Web Services Designer
+ private IContainer components = null;
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if(disposing && components != null)
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #endregion
+
+ // WEB SERVICE EXAMPLE
+ // The HelloWorld() example service returns the string Hello World
+ // To build, uncomment the following lines then save and build the
+project
+ // To test this web service, press F5
+
+ [WebMethod]
+ public String Test()
+ {
+
+ try
+ {
+ if (ChannelServices.RegisteredChannels.Length <=0)
+ {
+ IDictionary props = new Hashtable();
+ props["typeFilterLevel"] = "Full";
+ SoapServerFormatterSinkProvider formatterProvider = new
+SoapServerFormatterSinkProvider(props,null);
+ SoapClientFormatterSinkProvider clientProv = new
+SoapClientFormatterSinkProvider();
+ props["port"] = 5051;
+ HttpChannel channel = new
+HttpChannel(props,clientProv,formatterProvider);
+ ChannelServices.RegisterChannel(channel);
+ }
+ RemInterface.ITest test =
+(RemInterface.ITest)Activator.GetObject(typeof(RemInterface.ITest),"http://127.0.0.1:5050/test");
+
+ test.Str = "value set by client";
+ ClientTest clnTest = new ClientTest();
+ clnTest.Str = "This object was created on the client.";
+ test.ClientTest = clnTest;
+
+ }
+ catch(Exception ex)
+ {
+ return ex.ToString();
+ }
+ return "Worked";
+
+ }
+ }
+ public class ClientTest: RemInterface.IClientTest
+ {
+ private String nothing = "nothing";
+ //private String test = null;
+ }
+}
+
+=====================================================
+
More information about the mono-bugs
mailing list