public bool Init()
 {
     try
     {
         bool             result       = false;
         EndpointAddress  endPointAddr = new EndpointAddress(gcontext.GetInterfaceServiceUrl(ConnectServiceType.Soap));
         BasicHttpBinding binding      = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
         binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
         binding.ReceiveTimeout         = new TimeSpan(0, 10, 0);
         binding.MaxReceivedMessageSize = 1048576; //1MB
         binding.SendTimeout            = new TimeSpan(0, 10, 0);
         clientORN = new RightNowSyncPortClient(binding, endPointAddr);
         BindingElementCollection elements = clientORN.Endpoint.Binding.CreateBindingElements();
         elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
         clientORN.Endpoint.Binding = new CustomBinding(elements);
         gcontext.PrepareConnectSession(clientORN.ChannelFactory);
         if (clientORN != null)
         {
             result = true;
         }
         return(result);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error en INIT: " + ex.Message);
         return(false);
     }
 }
Ejemplo n.º 2
0
        public RightNowService(IGlobalContext _gContext)
        {
            // Set up SOAP API request to retrieve Endpoint Configuration -
            // Get the SOAP API url of current site as SOAP Web Service endpoint
            EndpointAddress endPointAddr = new EndpointAddress(_gContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));

            // Minimum required
            BasicHttpBinding binding2 = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
            binding2.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            // Optional depending upon use cases
            binding2.MaxReceivedMessageSize = 5 * 1024 * 1024;
            binding2.MaxBufferSize = 5 * 1024 * 1024;
            binding2.MessageEncoding = WSMessageEncoding.Mtom;

            // Create client proxy class
            _rnowClient = new RightNowSyncPortClient(binding2, endPointAddr);
            BindingElementCollection elements = _rnowClient.Endpoint.Binding.CreateBindingElements();
            elements.Find<SecurityBindingElement>().IncludeTimestamp = false;
            _rnowClient.Endpoint.Binding = new CustomBinding(elements);

            // Add SOAP msg inspector behavior
            //_rnowClient.Endpoint.Behaviors.Add(new LogMsgBehavior());

            // Ask the Add-In framework the handle the session logic
            _gContext.PrepareConnectSession(_rnowClient.ChannelFactory);

            // Set up query and set request
            _rnowClientInfoHeader = new ClientInfoHeader();
            _rnowClientInfoHeader.AppID = "Case Management Accelerator Services";
        }
Ejemplo n.º 3
0
        public Boolean initializeLogger(IGlobalContext globalContext)
        {
            EndpointAddress endPointAddr = new EndpointAddress(globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));

            // Minimum required
            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

            binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            // Optional depending upon use cases
            binding.MaxReceivedMessageSize = 1024 * 1024;
            binding.MaxBufferSize          = 1024 * 1024;
            binding.MessageEncoding        = WSMessageEncoding.Mtom;

            // Create client proxy class
            RightNowSyncPortClient client = new RightNowSyncPortClient(binding, endPointAddr);

            // Ask the client to not send the timestamp
            BindingElementCollection elements = client.Endpoint.Binding.CreateBindingElements();

            elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
            client.Endpoint.Binding = new CustomBinding(elements);

            // Ask the Add-In framework the handle the session logic
            globalContext.PrepareConnectSession(client.ChannelFactory);

            this.client    = client;
            this.extObject = getExtension();
            return(true);
        }
Ejemplo n.º 4
0
        public RightNowService(IGlobalContext _gContext)
        {
            // Set up SOAP API request to retrieve Endpoint Configuration -
            // Get the SOAP API url of current site as SOAP Web Service endpoint
            EndpointAddress endPointAddr = new EndpointAddress(_gContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));


            // Minimum required
            BasicHttpBinding binding2 = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

            binding2.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            // Optional depending upon use cases
            binding2.MaxReceivedMessageSize = 1024 * 1024;
            binding2.MaxBufferSize          = 1024 * 1024;
            binding2.MessageEncoding        = WSMessageEncoding.Mtom;

            // Create client proxy class
            _rnowClient = new RightNowSyncPortClient(binding2, endPointAddr);
            BindingElementCollection elements = _rnowClient.Endpoint.Binding.CreateBindingElements();

            elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
            _rnowClient.Endpoint.Binding = new CustomBinding(elements);

            // Add SOAP msg inspector behavior
            //_rnowClient.Endpoint.Behaviors.Add(new LogMsgBehavior());

            // Ask the Add-In framework the handle the session logic
            _gContext.PrepareConnectSession(_rnowClient.ChannelFactory);

            // Set up query and set request
            _rnowClientInfoHeader       = new ClientInfoHeader();
            _rnowClientInfoHeader.AppID = "Case Management Accelerator Services";
        }
        public bool Init()
        {
            try
            {
                bool            result       = false;
                EndpointAddress endPointAddr = new EndpointAddress(globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));
                // Minimum required
                BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
                binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
                binding.ReceiveTimeout         = new TimeSpan(0, 10, 0);
                binding.MaxReceivedMessageSize = 1048576; //1MB
                binding.SendTimeout            = new TimeSpan(0, 10, 0);
                // Create client proxy class
                clientRN = new RightNowSyncPortClient(binding, endPointAddr);
                // Ask the client to not send the timestamp
                BindingElementCollection elements = clientRN.Endpoint.Binding.CreateBindingElements();
                elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
                clientRN.Endpoint.Binding = new CustomBinding(elements);
                // Ask the Add-In framework the handle the session logic
                globalContext.PrepareConnectSession(clientRN.ChannelFactory);
                if (clientRN != null)
                {
                    result = true;
                }

                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
        public static RightNowConnectService GetService(IGlobalContext _globalContext)
        {
            if (_rightnowConnectService != null)
            {
                return(_rightnowConnectService);
            }

            try
            {
                lock (_sync)
                {
                    if (_rightnowConnectService == null)
                    {
                        // Initialize client with current interface soap url
                        string url = _globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap);

                        EndpointAddress endpoint = new EndpointAddress(_globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));

                        BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
                        binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

                        // Optional depending upon use cases
                        binding.MaxReceivedMessageSize = 1024 * 1024;
                        binding.MaxBufferSize          = 1024 * 1024;
                        binding.MessageEncoding        = WSMessageEncoding.Mtom;

                        _rightNowClient = new RightNowSyncPortClient(binding, endpoint);

                        BindingElementCollection elements = _rightNowClient.Endpoint.Binding.CreateBindingElements();
                        elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
                        _rightNowClient.Endpoint.Binding = new CustomBinding(elements);
                        WorkspaceAddIn._globalContext.PrepareConnectSession(_rightNowClient.ChannelFactory);

                        _rightnowConnectService = new RightNowConnectService();
                    }
                }
            }
            catch (Exception e)
            {
                _rightnowConnectService = null;

                //  WorkspaceAddIn.InfoLog(e.Message);
            }

            return(_rightnowConnectService);
        }
        private RightNowSyncPortChannel getChannel()
        {
            Binding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

            ((BasicHttpBinding)binding).Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
            ((BasicHttpBinding)binding).MaxBufferSize          = 1024 * 1024 * 1024;
            ((BasicHttpBinding)binding).MaxReceivedMessageSize = 1024 * 1024 * 1024;
            BindingElementCollection elements = binding.CreateBindingElements();

            elements.Find <SecurityBindingElement>().IncludeTimestamp = false;

            binding = new CustomBinding(elements);

            var channelFactory = new ChannelFactory <RightNowSyncPortChannel>(binding, new EndpointAddress(_globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap)));

            _globalContext.PrepareConnectSession(channelFactory);
            var rightNowChannel = channelFactory.CreateChannel();

            return(rightNowChannel);
        }