/// <summary> /// reads a locate-request message from the message input stream msgInput /// and formulates an answer. /// </summary> /// <returns></returns> internal Stream SerialiseOutgoingLocateReplyMessage(LocateReplyMessage replyMsg, LocateRequestMessage requestMsg, GiopVersion version, Stream targetStream, GiopConnectionDesc conDesc) { GiopHeader header = new GiopHeader(version.Major, version.Minor, m_headerFlags, GiopMsgTypes.LocateReply); CdrMessageOutputStream msgOutput = new CdrMessageOutputStream(targetStream, header); // serialize the message m_ser.SerialiseLocateReply(msgOutput.GetMessageContentWritingStream(), version, requestMsg.RequestId, replyMsg); msgOutput.CloseStream(); // write to the stream return(targetStream); }
/// <summary>serialises an outgoing .NET reply Message on server side</summary> internal void SerialiseOutgoingReplyMessage(IMessage replyMsg, IMessage requestMsg, GiopVersion version, Stream targetStream, GiopConnectionDesc conDesc) { if (replyMsg is ReturnMessage) { // write a CORBA response message into the stream targetStream GiopHeader header = new GiopHeader(version.Major, version.Minor, m_headerFlags, GiopMsgTypes.Reply); CdrMessageOutputStream msgOutput = new CdrMessageOutputStream(targetStream, header); GiopServerRequest request = new GiopServerRequest(requestMsg, (ReturnMessage)replyMsg, conDesc, m_interceptionOptions); // serialize the message m_ser.SerialiseReply(request, msgOutput.GetMessageContentWritingStream(), version, conDesc); msgOutput.CloseStream(); // write to the stream } else { throw new NotImplementedException("handling for this type of .NET message is not implemented at the moment, type: " + replyMsg.GetType()); } }
/// <summary>serialises an outgoing .NET request Message on client side</summary> internal void SerialiseOutgoingRequestMessage(IMessage msg, IIorProfile target, GiopClientConnectionDesc conDesc, Stream targetStream, uint requestId) { if (msg is IConstructionCallMessage) { // not supported in CORBA, TBD: replace through do nothing instead of exception throw new NotSupportedException("client activated objects are not supported with this channel"); } else if (msg is IMethodCallMessage) { GiopVersion version = target.Version; // write a CORBA request message into the stream targetStream GiopHeader header = new GiopHeader(version.Major, version.Minor, m_headerFlags, GiopMsgTypes.Request); CdrMessageOutputStream msgOutput = new CdrMessageOutputStream(targetStream, header); // serialize the message, this insert some data into msg, e.g. request-id msg.Properties[SimpleGiopMsg.REQUEST_ID_KEY] = requestId; // set request-id msg.Properties[SimpleGiopMsg.TARGET_PROFILE_KEY] = target; GiopClientRequest request = new GiopClientRequest((IMethodCallMessage)msg, conDesc, m_interceptionOptions); m_ser.SerialiseRequest(request, msgOutput.GetMessageContentWritingStream(), target, conDesc); msgOutput.CloseStream(); if ((request.IsAsyncRequest) || (request.IsOneWayCall)) { // after successful serialisation, call for oneway and async requests receive other, // see corba 2.6, page 21-12. request.InterceptReceiveOther(); } } else { throw new NotImplementedException("handling for this type of .NET message is not implemented at the moment, type: " + msg.GetType()); } }
/// <summary> /// reads a locate-request message from the message input stream msgInput /// and formulates an answer. /// </summary> /// <returns></returns> internal Stream SerialiseOutgoingLocateReplyMessage(LocateReplyMessage replyMsg, LocateRequestMessage requestMsg, GiopVersion version, Stream targetStream, GiopConnectionDesc conDesc) { GiopHeader header = new GiopHeader(version.Major, version.Minor, m_headerFlags, GiopMsgTypes.LocateReply); CdrMessageOutputStream msgOutput = new CdrMessageOutputStream(targetStream, header); // serialize the message m_ser.SerialiseLocateReply(msgOutput.GetMessageContentWritingStream(), version, requestMsg.RequestId, replyMsg); msgOutput.CloseStream(); // write to the stream return targetStream; }