public void CreateIorForCorbaLocUrlWithCodeSetComponent() { string testCorbaLoc = "corbaloc:iiop:[email protected]:1234/test"; Ior iorForUrl = m_iiopUrlUtil.CreateIorForUrl(testCorbaLoc, String.Empty); CheckIorForUrl(iorForUrl, 1, true); }
private Ior DetermineTarget(IMessage msg) { IMethodMessage methodMsg = msg as IMethodMessage; if ((methodMsg == null) || (methodMsg.Uri == null)) { throw new INTERNAL(319, CompletionStatus.Completed_No); } // for urls, which are not stringified iors, no very accurate type information, // because pass as repository id information base type of all corba interfaces: Object; // for urls, which are stringified iors, the type information is extracted from the ior directly Ior target = m_iiopUrlUtil.CreateIorForUrl(methodMsg.Uri, ""); if (target == null) { throw new INTERNAL(319, CompletionStatus.Completed_No); } return(target); }
public void TestRequestSerialisation() { // prepare message MethodInfo methodToCall = typeof(TestService).GetMethod("Add"); object[] args = new object[] { ((Int32)1), ((Int32)2) }; string uri = "iiop://localhost:8087/testuri"; // Giop 1.2 will be used because no version spec in uri Ior target = m_iiopUrlUtil.CreateIorForUrl(uri, ""); TestMessage msg = new TestMessage(methodToCall, args, uri); // prepare connection context GiopClientConnectionDesc conDesc = new GiopClientConnectionDesc(null, null, new GiopRequestNumberGenerator(), null); // serialise MemoryStream targetStream = new MemoryStream(); uint reqId = 5; m_handler.SerialiseOutgoingRequestMessage(msg, target.Profiles[0], conDesc, targetStream, reqId); // check to serialised stream targetStream.Seek(0, SeekOrigin.Begin); CdrInputStreamImpl cdrIn = new CdrInputStreamImpl(targetStream); cdrIn.ConfigStream(0, new GiopVersion(1, 2)); // first is Giop-magic byte data; AssertBytesFollowing(m_giopMagic, cdrIn); // Giop version data = (byte)cdrIn.ReadOctet(); Assert.AreEqual(1, data); data = (byte)cdrIn.ReadOctet(); Assert.AreEqual(2, data); // flags: big-endian, no fragements data = (byte)cdrIn.ReadOctet(); Assert.AreEqual(0, data); // Giop Msg type: request data = (byte)cdrIn.ReadOctet(); Assert.AreEqual(0, data); // Giop Msg length uint msgLength = cdrIn.ReadULong(); cdrIn.SetMaxLength(msgLength); // req-id Assert.AreEqual(reqId, cdrIn.ReadULong()); // response flags data = (byte)cdrIn.ReadOctet(); Assert.AreEqual(3, data); cdrIn.ReadPadding(3); // reserved // target Assert.AreEqual(0, cdrIn.ReadUShort()); // target must be testuri encoded as ascii-characters Assert.AreEqual(7, cdrIn.ReadULong()); AssertBytesFollowing( new byte[] { 116, 101, 115, 116, 117, 114, 105 }, cdrIn); // now the target method follows: Add (string is terminated by a zero) Assert.AreEqual(4, cdrIn.ReadULong()); AssertBytesFollowing(new byte[] { 65, 100, 100, 0 }, cdrIn); // now service contexts are following SkipServiceContexts(cdrIn); // Giop 1.2, must be aligned on 8 cdrIn.ForceReadAlign(Aligns.Align8); // now params are following Assert.AreEqual(1, cdrIn.ReadLong()); Assert.AreEqual(2, cdrIn.ReadLong()); }