コード例 #1
0
ファイル: AxAccess.cs プロジェクト: tschwenneker/To-Increase
        public string executePing()
        {
            string message = "";

            var context = new BisWebserviceReferences.CallContext()
            {//todo
                Language = clientConfig.LanguageId,
                Company  = clientConfig.CompanyId
            };


            //handle the soap content to retrieve the data from the content
            using (OperationContextScope operationContextScope = new OperationContextScope(channel))
            {
                // ensure that we do NOT fallback to SSL3
                System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

                HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
                requestMessage.Headers[OAuthHelper.OAuthHeader] = oauthHeader;
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
                // add the New reference and remove the old service references to httpmessage
                //result = ((BisMessageHttpActionServiceReference.BisMessageStartFromHttp)channel).executeMessage(new BisMessageHttpActionServiceReference.executeMessage(context, project, webservice,  content)).result;

                message = ((BisWebserviceReferences.BisWsWebserviceCall)channel).ping(
                    new BisWebserviceReferences.ping(context, BisConUrlHttpAction.Post, "dummy", "dummy")).result;
            }

            return(message);
        }
コード例 #2
0
ファイル: AxAccess.cs プロジェクト: tschwenneker/To-Increase
        public string executeWebservice(string project, string webservice, string content)
        {
            string result = "";

            try
            {
                var context = new BisWebserviceReferences.CallContext()
                {//todo
                    Language = clientConfig.LanguageId,
                    Company  = clientConfig.CompanyId
                };


                //handle the soap content to retrieve the data from the content
                using (OperationContextScope operationContextScope = new OperationContextScope(channel))
                {
                    // ensure that we do NOT fallback to SSL3
                    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
                    HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
                    requestMessage.Headers[OAuthHelper.OAuthHeader] = oauthHeader;
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
                    // add the New reference and remove the old service references to httpmessage
                    //result = ((BisMessageHttpActionServiceReference.BisMessageStartFromHttp)channel).executeMessage(new BisMessageHttpActionServiceReference.executeMessage(context, project, webservice,  content)).result;

                    result = ((BisWebserviceReferences.BisWsWebserviceCall)channel).executeOperation(
                        new BisWebserviceReferences.executeOperation(
                            context, this.convertHttpActionToEnum(httpaction), project, url, userName, webservice, content)
                        ).result;
                }

                // add the  content back to the correct soap response
                return(result);
            }
            catch (Exception ex)
            {
                result = String.Format("<xml>Error: {0}</xml>", ex.Message);

                return(result);
            }

            // return result;
        }