First off, I dont know much about .net or web service calls. So my apologies if this question has been answered before.
I have the following piece of code that iterates over a dataset populated by an Execute SQL Task in SSIS. I need to take these values and send them to the web service so that the web service can do whatever it wants. I have go to the part where I can iterate over the records, but I am not sure how to refer to the columns in the web service call. Meaning, if the service call was xyz(val1,val2,val3,val4), how do I associate val values to the datatable that I have created?
public void Main()
{
// TODO: Add your code here
var caseObj = Dts.Variables["User::QCase"].Value;
var serviceURI = Dts.Variables["User::WebServiceURI"].Value.ToString();
var oleDA = new OleDbDataAdapter();
var httpBinding = new BasicHttpBinding();
var dt = new DataTable();
string sMsg;
oleDA.Fill(dt, Dts.Variables["User::QCases"].Value);
foreach (DataRow row in dt.Rows)
foreach (DataColumn col in dt.Columns)
{
var caseProxy = new CaseService.CServicesProxyClient(httpBinding, new EndpointAddress(serviceURI));
sMsg = "";
sMsg = sMsg + col.ColumnName + ": " + (col.Ordinal).ToString() + vbCrLf;
MessageBox.Show(sMsg);
var results = caseProxy.SaveCaseStatusChange(dt, 0, false, null); //This is the service call which will push the values to the web service. dt is the data table.
}
/* if (results)
{
Dts.TaskResult = (int)ScriptResults.Success;
}
else
{
Dts.TaskResult = (int)ScriptResults.Failure;
}*/
}
#region ScriptResults declaration
/// <summary>
/// This enum provides a convenient shorthand within the scope of this class for setting the
/// result of the script.
///
/// This code was generated automatically.
/// </summary>
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
public object vbCrLf { get; set; }
}
}
I hope I have provided sufficient details, but if not, I will be more than happy to provide. Thank you for taking the time to read the question.