Пример #1
0
        private IEnumerable <object> ReadData(string serviceUrl, string methodName, string nameSpace, string soapAction, string encodingName, IDictionary <string, object> parameters)
        {
            var webService = new SimpleWebserviceRequest(serviceUrl, methodName, nameSpace, "", soapAction, encodingName, removeNamespaces: true, unescapeResult: null);

            var data = this.InvokeWebserviceWithParameters(webService, parameters);

            yield return(data);
        }
Пример #2
0
        private object InvokeWebserviceWithParameters(SimpleWebserviceRequest webService, IDictionary <string, object> values = null)
        {
            webService.Parameters.Clear();

            // Take the values, which are defined in the mapping
            foreach (var dataMapping in this.DataMappings)
            {
                var webserviceParameter = new SimpleWebserviceRequest.WebserviceParameter()
                {
                    Name = dataMapping.Name,
                    Type = dataMapping.DataType.ToString()
                };

                if (dataMapping.Value != null)
                {
                    // replace token e.g {Filename} ->  C:\Temp\Test.txt
                    webserviceParameter.Value = TokenProcessor.ReplaceTokens(dataMapping.Value.ToStringOrEmpty(), values);
                }
                //else
                //{
                //    // set the value
                //    webserviceParameter.Value = values.GetValue(dataMapping.Name);
                //}

                webService.Parameters.Add(webserviceParameter);
            }

            // call the service
            var result = webService.Invoke();

            // format the result
            object data = null;

            if (this.formatter != null && result != null)
            {
                data = this.formatter.Format(result.OuterXml, null);
            }

            return(data);
        }