Export (0) Print
Expand All

RemotingServices.Unmarshal Method

Converts a given ObjRef into a proxy object.

Overload List

Takes an ObjRef and creates a proxy object out of it.

[Visual Basic] Overloads Public Shared Function Unmarshal(ObjRef) As Object
[C#] public static object Unmarshal(ObjRef);
[C++] public: static Object* Unmarshal(ObjRef*);
[JScript] public static function Unmarshal(ObjRef) : Object;

Takes an ObjRef and creates a proxy object out of it, refining it to the type on the server.

[Visual Basic] Overloads Public Shared Function Unmarshal(ObjRef, Boolean) As Object
[C#] public static object Unmarshal(ObjRef, bool);
[C++] public: static Object* Unmarshal(ObjRef*, bool);
[JScript] public static function Unmarshal(ObjRef, Boolean) : Object;

Example

[Visual Basic, C#, C++] The following example demonstrates how to unmarshal an object.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Unmarshal. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
ChannelServices.RegisterChannel(New HttpChannel())

Dim objectSample As SampleService = CType(Activator.GetObject(GetType(SampleService), _ 
      "http://localhost:9000/MySampleService/SampleService.soap"), SampleService)

' The GetManuallyMarshaledObject() method uses RemotingServices.Marshal()
' to create an ObjRef object for a SampleTwo object.
Dim objRefSampleTwo As ObjRef = objectSample.GetManuallyMarshaledObject()

Dim objectSampleTwo As SampleTwo = CType(RemotingServices.Unmarshal(objRefSampleTwo), SampleTwo)

objectSampleTwo.PrintMessage("I successfully unmarshaled your ObjRef.  Thanks.")

[C#] 
ChannelServices.RegisterChannel(new HttpChannel());

SampleService objectSample = (SampleService)Activator.GetObject(typeof(SampleService), 
    "http://localhost:9000/MySampleService/SampleService.soap");

// The GetManuallyMarshaledObject() method uses RemotingServices.Marshal()
// to create an ObjRef object for a SampleTwo object.
ObjRef objRefSampleTwo = objectSample.GetManuallyMarshaledObject();

SampleTwo objectSampleTwo = (SampleTwo)RemotingServices.Unmarshal(objRefSampleTwo);

objectSampleTwo.PrintMessage("ObjRef successfuly unmarshaled."); 

[C++] 
ChannelServices::RegisterChannel(new HttpChannel());

SampleService* objectSample = dynamic_cast<SampleService*>(Activator::GetObject(__typeof(SampleService), 
    S"http://localhost:9000/MySampleService/SampleService.soap"));

Console::WriteLine(S"http://localhost:9000/MySampleService/SampleService.soap");

// The GetManuallyMarshaledObject() method uses RemotingServices::Marshal()
// to create an ObjRef object for a SampleTwo object.
ObjRef* objRefSampleTwo = objectSample->GetManuallyMarshaledObject();

SampleTwo* objectSampleTwo = dynamic_cast<SampleTwo*>(RemotingServices::Unmarshal(objRefSampleTwo));

objectSampleTwo->PrintMessage(S"ObjRef successfuly unmarshaled."); 

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

RemotingServices Class | RemotingServices Members | System.Runtime.Remoting Namespace

Show:
© 2014 Microsoft