示例#1
0
 void OnByeNotice(string mexAddress, Uri[] scopes)
 {
     if (SynchronizationContext.Current != m_SynchronizationContext)
     {
         SendOrPostCallback notice = (state) =>
         {
             string address = state as string;
             OnByeNotice(address, scopes);
         };
         m_SynchronizationContext.Post(notice, mexAddress);
         return;
     }
     foreach (ServiceNode service in m_MexTree.Nodes)
     {
         if (service.MexAddress == mexAddress)
         {
             m_MexTree.Nodes.Remove(service);
             break;
         }
     }
     if (m_MexTree.Nodes.Count == 0)
     {
         DisplayBlankControl();
     }
     else
     {
         CurrentNode = m_MexTree.Nodes[0] as ServiceNode;
         m_MexAddressTextBox.Text = CurrentNode.MexAddress;
         DisplayServiceControl();
     }
 }
示例#2
0
        void OnHelloNotice(string mexAddress, Uri[] scopes)
        {
            if (SynchronizationContext.Current != m_SynchronizationContext)
            {
                SendOrPostCallback notice = (state) =>
                {
                    string address = state as string;
                    OnHelloNotice(address, scopes);
                };
                m_SynchronizationContext.Post(notice, mexAddress);
                return;
            }
            m_MexAddressTextBox.Text = mexAddress;

            OnExplore(this, EventArgs.Empty);

            foreach (ServiceNode node in m_MexTree.Nodes)
            {
                if (node.MexAddress == mexAddress)
                {
                    CurrentNode = node;
                    m_MexAddressTextBox.Text = mexAddress;
                    m_MexTree.SelectedNode   = node;
                    m_MexTree.Focus();
                }
            }
        }
        void ExploreServiceBus(string mexAddress)
        {
            ServiceNode existingNode = null;

            try
            {
                Uri address = new Uri(mexAddress);
                ServiceEndpoint[] endpoints = null;

                //Find if tree already contain this address
                foreach (ServiceNode node in m_MexTree.Nodes)
                {
                    if (node.MexAddress == mexAddress)
                    {
                        if (node.Text == "Unspecified Base Address" || node.Text == "Invalid Address")
                        {
                            node.ImageIndex = node.SelectedImageIndex = ServiceIndex;
                        }
                        existingNode = node;
                        break;
                    }
                }

                endpoints = GetServiceBusEndpoints();

                ProcessMetaData(existingNode, mexAddress, endpoints);
            }
            catch
            {
                if (existingNode == null)
                {
                    CurrentNode = new ServiceNode(mexAddress, this, "Invalid Address", ServiceError, ServiceError);
                    m_MexTree.Nodes.Add(CurrentNode);
                }
                else
                {
                    CurrentNode.Text = "Invalid Address";
                    CurrentNode.Nodes.Clear();
                    CurrentNode.ImageIndex = CurrentNode.SelectedImageIndex = ServiceError;
                }
            }
        }
示例#4
0
        void ProcessMetaData(ServiceNode existingNode, string mexAddress, ServiceEndpoint[] endpoints)
        {
            if (existingNode == null)
            {
                if (endpoints.Length == 0)
                {
                    CurrentNode = new ServiceNode(mexAddress, this, "Service has no endpoints", ServiceIndex, ServiceIndex);
                    m_MexTree.Nodes.Add(CurrentNode);
                    return;
                }
                else
                {
                    CurrentNode = new ServiceNode(mexAddress, this, "Exploring...", ServiceIndex, ServiceIndex);
                    m_MexTree.Nodes.Add(CurrentNode);
                }
            }
            else
            {
                CurrentNode = existingNode;

                if (endpoints.Length == 0)
                {
                    CurrentNode.Text = "Service has no endpoints";
                    return;
                }
                else
                {
                    CurrentNode.Text = "Exploring...";
                    CurrentNode.Nodes.Clear();
                }
            }
            int index = 1;

            foreach (ServiceEndpoint endpoint in endpoints)
            {
                AddEndPoint(endpoint, "Endpoint" + index);
                index++;
            }
            DisplayServiceControl();
        }
示例#5
0
 void ProcessMetaData(ServiceNode existingNode, string mexAddress, ServiceEndpointCollection endpoints)
 {
     ProcessMetaData(existingNode, mexAddress, endpoints.ToArray());
 }
示例#6
0
        void Explore(string mexAddress)
        {
            ServiceNode existingNode = null;

            try
            {
                Uri address = new Uri(mexAddress);
                ServiceEndpointCollection endpoints = null;

                //Find if tree already contain this address
                foreach (ServiceNode node in m_MexTree.Nodes)
                {
                    if (node.MexAddress == mexAddress)
                    {
                        if (node.Text == "Unspecified Base Address" || node.Text == "Invalid Address")
                        {
                            node.ImageIndex = node.SelectedImageIndex = ServiceIndex;
                        }
                        existingNode = node;
                        break;
                    }
                }
                if (address.Scheme == "http")
                {
                    HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement();
                    httpBindingElement.MaxReceivedMessageSize *= MessageMultiplier;

                    //Try the HTTP MEX Endpoint
                    try
                    {
                        endpoints = GetEndpoints(httpBindingElement);
                    }
                    catch
                    {}
                    //Try over HTTP-GET
                    if (endpoints == null)
                    {
                        string httpGetAddress = mexAddress;
                        if (mexAddress.EndsWith("?wsdl") == false)
                        {
                            httpGetAddress += "?wsdl";
                        }
                        CustomBinding          binding   = new CustomBinding(httpBindingElement);
                        MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding);
                        MetadataSet            metadata  = MEXClient.GetMetadata(new Uri(httpGetAddress), MetadataExchangeClientMode.HttpGet);
                        MetadataImporter       importer  = new WsdlImporter(metadata);
                        endpoints = importer.ImportAllEndpoints();
                    }
                }
                if (address.Scheme == "https")
                {
                    HttpsTransportBindingElement httpsBindingElement = new HttpsTransportBindingElement();
                    httpsBindingElement.MaxReceivedMessageSize *= MessageMultiplier;

                    //Try the HTTPS MEX Endpoint
                    try
                    {
                        endpoints = GetEndpoints(httpsBindingElement);
                    }
                    catch
                    {
                    }
                    //Try over HTTP-GET
                    if (endpoints == null)
                    {
                        string httpsGetAddress = mexAddress;
                        if (mexAddress.EndsWith("?wsdl") == false)
                        {
                            httpsGetAddress += "?wsdl";
                        }
                        CustomBinding          binding   = new CustomBinding(httpsBindingElement);
                        MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding);
                        MetadataSet            metadata  = MEXClient.GetMetadata(new Uri(httpsGetAddress), MetadataExchangeClientMode.HttpGet);
                        MetadataImporter       importer  = new WsdlImporter(metadata);
                        endpoints = importer.ImportAllEndpoints();
                    }
                }
                if (address.Scheme == "net.tcp")
                {
                    TcpTransportBindingElement tcpBindingElement = new TcpTransportBindingElement();
                    tcpBindingElement.MaxReceivedMessageSize *= MessageMultiplier;
                    endpoints = GetEndpoints(tcpBindingElement);
                }
                if (address.Scheme == "net.pipe")
                {
                    NamedPipeTransportBindingElement ipcBindingElement = new NamedPipeTransportBindingElement();
                    ipcBindingElement.MaxReceivedMessageSize *= MessageMultiplier;
                    endpoints = GetEndpoints(ipcBindingElement);
                }
                ProcessMetaData(existingNode, mexAddress, endpoints);
            }
            catch
            {
                if (existingNode == null)
                {
                    CurrentNode = new ServiceNode(mexAddress, this, "Invalid Address", ServiceError, ServiceError);
                    m_MexTree.Nodes.Add(CurrentNode);
                }
                else
                {
                    CurrentNode.Text = "Invalid Address";
                    CurrentNode.Nodes.Clear();
                    CurrentNode.ImageIndex = CurrentNode.SelectedImageIndex = ServiceError;
                }
            }
        }
      void ExploreServiceBus(string mexAddress)
      {
         ServiceNode existingNode = null;

         try
         {
            Uri address = new Uri(mexAddress);
            ServiceEndpoint[] endpoints = null;

            //Find if tree already contain this address
            foreach(ServiceNode node in m_MexTree.Nodes)
            {
               if(node.MexAddress == mexAddress)
               {
                  if(node.Text == "Unspecified Base Address" || node.Text == "Invalid Address")
                  {
                     node.ImageIndex = node.SelectedImageIndex = ServiceIndex;
                  }
                  existingNode = node;
                  break;
               }
            }

            endpoints = GetServiceBusEndpoints();

            ProcessMetaData(existingNode,mexAddress,endpoints);
         }
         catch
         {
            if(existingNode == null)
            {
               CurrentNode = new ServiceNode(mexAddress,this,"Invalid Address",ServiceError,ServiceError);
               m_MexTree.Nodes.Add(CurrentNode);
            }
            else
            {
               CurrentNode.Text = "Invalid Address";
               CurrentNode.Nodes.Clear();
               CurrentNode.ImageIndex = CurrentNode.SelectedImageIndex = ServiceError;
            }
         }
      }
示例#8
0
      void OnHelloNotice(string mexAddress,Uri[] scopes)
      {
         if(SynchronizationContext.Current != m_SynchronizationContext)
         {
            SendOrPostCallback notice = (state)=>
                                        {
                                           string address = state as string;
                                           OnHelloNotice(address,scopes);
                                        };
            m_SynchronizationContext.Post(notice,mexAddress);
            return;
         }
         m_MexAddressTextBox.Text = mexAddress;

         OnExplore(this,EventArgs.Empty);         

         foreach(ServiceNode node in m_MexTree.Nodes)
         {
            if(node.MexAddress == mexAddress)
            {
               CurrentNode = node;
               m_MexAddressTextBox.Text = mexAddress;
               m_MexTree.SelectedNode = node;
               m_MexTree.Focus();
            }
         }
      }
示例#9
0
 void OnByeNotice(string mexAddress,Uri[] scopes)
 {
    if(SynchronizationContext.Current != m_SynchronizationContext)
    {
       SendOrPostCallback notice = (state)=>
                                   {
                                      string address = state as string;
                                      OnByeNotice(address,scopes);
                                   };
       m_SynchronizationContext.Post(notice,mexAddress);
       return;
    }
    foreach(ServiceNode service in m_MexTree.Nodes)
    {
       if(service.MexAddress == mexAddress)
       {
          m_MexTree.Nodes.Remove(service);
          break;
       }
    }
    if(m_MexTree.Nodes.Count == 0)
    {
       DisplayBlankControl();
    }
    else
    {
       CurrentNode = m_MexTree.Nodes[0] as ServiceNode;
       m_MexAddressTextBox.Text = CurrentNode.MexAddress; 
       DisplayServiceControl();
    }
 }
示例#10
0
 void ProcessMetaData(ServiceNode existingNode,string mexAddress,ServiceEndpoint[] endpoints)
 {
    if(existingNode == null)
    {
       if(endpoints.Length == 0)
       {
          CurrentNode = new ServiceNode(mexAddress,this,"Service has no endpoints",ServiceIndex,ServiceIndex);
          m_MexTree.Nodes.Add(CurrentNode);
          return;
       }
       else
       {
          CurrentNode = new ServiceNode(mexAddress,this,"Exploring...",ServiceIndex,ServiceIndex);
          m_MexTree.Nodes.Add(CurrentNode);
       }
    }
    else
    {
       CurrentNode = existingNode;
       
       if(endpoints.Length == 0)
       {
          CurrentNode.Text = "Service has no endpoints";
          return;
       }
       else
       {
          CurrentNode.Text = "Exploring...";
          CurrentNode.Nodes.Clear();
       }
    }
    int index = 1;
    foreach(ServiceEndpoint endpoint in endpoints)
    {
       AddEndPoint(endpoint,"Endpoint"+index);
       index++;
    }
    DisplayServiceControl();
 }
示例#11
0
 void ProcessMetaData(ServiceNode existingNode,string mexAddress,ServiceEndpointCollection endpoints)
 {
    ProcessMetaData(existingNode,mexAddress,endpoints.ToArray());
 }
示例#12
0
      void Explore(string mexAddress)
      {     
         ServiceNode existingNode = null;

         try
         {
            Uri address = new Uri(mexAddress);
            ServiceEndpointCollection endpoints = null;            

            //Find if tree already contain this address
            foreach(ServiceNode node in m_MexTree.Nodes)
            {
               if(node.MexAddress == mexAddress)
               {
                  if(node.Text == "Unspecified Base Address" || node.Text == "Invalid Address")
                  {
                     node.ImageIndex = node.SelectedImageIndex = ServiceIndex;
                  }
                  existingNode = node;
                  break;
               }
            }
            if(address.Scheme == "http")
            {
               HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement();
               httpBindingElement.MaxReceivedMessageSize *= MessageMultiplier;

               //Try the HTTP MEX Endpoint
               try
               {
                  endpoints = GetEndpoints(httpBindingElement);
               }
               catch
               {}
               //Try over HTTP-GET
               if(endpoints == null)
               {
                  string httpGetAddress = mexAddress;
                  if(mexAddress.EndsWith("?wsdl") == false)
                  {
                     httpGetAddress += "?wsdl";
                  }
                  CustomBinding binding = new CustomBinding(httpBindingElement);
                  MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding);
                  MetadataSet metadata = MEXClient.GetMetadata(new Uri(httpGetAddress),MetadataExchangeClientMode.HttpGet);
                  MetadataImporter importer = new WsdlImporter(metadata);
                  endpoints = importer.ImportAllEndpoints();
               }
            }
            if(address.Scheme == "https")
            {
               HttpsTransportBindingElement httpsBindingElement = new HttpsTransportBindingElement();
               httpsBindingElement.MaxReceivedMessageSize *= MessageMultiplier;

               //Try the HTTPS MEX Endpoint
               try
               {
                  endpoints = GetEndpoints(httpsBindingElement);
               }
               catch
               {
               }
               //Try over HTTP-GET
               if(endpoints == null)
               {
                  string httpsGetAddress = mexAddress;
                  if(mexAddress.EndsWith("?wsdl") == false)
                  {
                     httpsGetAddress += "?wsdl";
                  }
                  CustomBinding binding = new CustomBinding(httpsBindingElement);
                  MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding);
                  MetadataSet metadata = MEXClient.GetMetadata(new Uri(httpsGetAddress),MetadataExchangeClientMode.HttpGet);
                  MetadataImporter importer = new WsdlImporter(metadata);
                  endpoints = importer.ImportAllEndpoints();
               }
            }
            if(address.Scheme == "net.tcp")
            {
               TcpTransportBindingElement tcpBindingElement = new TcpTransportBindingElement();
               tcpBindingElement.MaxReceivedMessageSize *= MessageMultiplier;
               endpoints = GetEndpoints(tcpBindingElement);
            }
            if(address.Scheme == "net.pipe")
            {
               NamedPipeTransportBindingElement ipcBindingElement = new NamedPipeTransportBindingElement();
               ipcBindingElement.MaxReceivedMessageSize *= MessageMultiplier;
               endpoints = GetEndpoints(ipcBindingElement);
            }
            ProcessMetaData(existingNode,mexAddress,endpoints);
         }
         catch
         {
            if(existingNode == null)
            {
               CurrentNode = new ServiceNode(mexAddress,this,"Invalid Address",ServiceError,ServiceError);
               m_MexTree.Nodes.Add(CurrentNode);
            }
            else
            {
               CurrentNode.Text = "Invalid Address";
               CurrentNode.Nodes.Clear();
               CurrentNode.ImageIndex = CurrentNode.SelectedImageIndex = ServiceError;
            }
         }
      }