I am new to scripting (new to SSIS as well); I am trying to consume a web service URL and trying to generate XML from it. The way the web service is configured, I cannot use a Web Service Task in SSIS, so I am trying to use the script task but I am getting some "binding error". I searched and read lot of online articles but since I don't have much scripting experience I keep getting the error:
#region Namespaces
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
#endregion
namespace ST_c9ff0d0cdf0a455e804af51f85eb8494
{
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure,
};
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
public void Main()
{
var binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
binding.Security.Transport.Realm = "";
binding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Default;
var endpointAddress = new EndpointAddress("Web Service URL");
dmvcrashns.RMSIntegrationServiceSoapClient soapClient = new dmvcrashns.RMSIntegrationServiceSoapClient(binding, endpointAddress);
soapClient.ClientCredentials.UserName.UserName = "username";
soapClient.ClientCredentials.UserName.Password = "password";
dmvcrashns.FindLEApprovedCrashesRequest r = new dmvcrashns.FindLEApprovedCrashesRequest();
r.pStart = new DateTime(2016, 09, 01);
r.pEnd = new DateTime(2017, 01, 01);
dmvcrashns.RMSIntegrationServiceSoapClient c = new dmvcrashns.RMSIntegrationServiceSoapClient();
var resp = c.FindLEApprovedCrashes(new dmvcrashns.TREDSCredentials() {
Password = "username",
UserName = "password" },
r.pStart, r.pEnd);
}
}
}
Error Message:
Could not find default endpoint element that references contract 'dmvcrashns.RMSIntegrationServiceSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.