Пример #1
0
 public void TestParseUrlSsl()
 {
     string testIiopLoc = "iiop-ssl://elca.ch:1234/test";
     IiopLoc parsed = new IiopLoc(testIiopLoc, m_codec,
                                  new object[] { m_defaultCodeSetTaggedComponent });
     string objectUri;
     GiopVersion version;
     Uri channelUri = parsed.ParseUrl(out objectUri, out version);
     Assert.AreEqual("test", objectUri, "object uri");
     Assert.AreEqual(1, version.Major,"version major");
     Assert.AreEqual(2, version.Minor, "version minor");
     Assert.AreEqual("iiop-ssl1.2://elca.ch:1234/",
                            channelUri.AbsoluteUri, "channel uri");
 }
Пример #2
0
 /// <summary>
 /// This method parses an url for the IIOP channel. 
 /// It extracts the channel URI and the objectURI
 /// </summary>
 /// <param name="url">the url to parse</param>
 /// <param name="objectURI">the objectURI</param>
 /// <returns>the channel-Uri</returns>
 internal Uri ParseUrl(string url, out string objectUri,
                       out GiopVersion version)
 {
     Uri uri = null;
     if (url.StartsWith("iiop"))
     {
         IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                       m_defaultAdditionalTaggedComponents);
         uri = iiopLoc.ParseUrl(out objectUri, out version);
     }
     else if (url.StartsWith("IOR"))
     {
         Ior ior = new Ior(url);
         IInternetIiopProfile profile = ior.FindInternetIiopProfile();
         if (profile != null)
         {
             uri = new Uri("iiop" + profile.Version.Major + "." + profile.Version.Minor +
                       Uri.SchemeDelimiter + profile.HostName + ":" + profile.Port);
             objectUri = IorUtil.GetObjectUriForObjectKey(profile.ObjectKey);
             version = profile.Version;
         }
         else
         {
             uri = null;
             objectUri = null;
             version = new GiopVersion(1, 0);
         }
     }
     else if (url.StartsWith("corbaloc"))
     {
         Corbaloc loc = new Corbaloc(url, m_codec,
                                     m_defaultAdditionalTaggedComponents);
         uri = loc.ParseUrl(out objectUri, out version);
     }
     else
     {
         // not possible
         uri = null;
         objectUri = null;
         version = new GiopVersion(1, 0);
     }
     return uri;
 }