What is not working exactly?
The automated access to app.config does not exist in a Script Task as it extends the VS Shell not a full Visual Studio product.
To consume a Webservice we have many examples online e.g. http://social.technet.microsoft.com/wiki/contents/articles/22587.consume-webservice-via-ssis-script-component.aspx
I am using visual studio 2012, I created a new Integration services project, in there I added a Script task in the control flow, when I edit the script task, I added a Service reference, when adding this reference I did not select any other <g class="gr_ gr_37 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="37" id="37">non default</g> parameters, I then added the using statement (using ST_587c366481b44da49c6b3a7a0fab4ee5.ServiceReference1) In the public main() I declared a new variable var temp = new ServiceReference1.AnimalServiceClient(); when I run it I get this error:
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Service incompatible.
E.g. the .net framework versions used in it and the VS 2012 to target SSIS 2012
I went ahead and made sure the web service .net version match the one from the SSIS package (4.5) I also added the bindings per the article you send me on Friday but now I am getting an error saying it can't find the end point:
There was no endpoint listening at https://dnna-api-test.azurewebsites.net/AnimalService.svc?wsdl that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
I tried it with and without the ?<g class="gr_ gr_279 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="279" id="279">wsdl</g> on the URL, this is my code now:
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
binding.MaxBufferSize = 2147483647;
binding.MaxBufferPoolSize = 2147483647;
binding.MaxReceivedMessageSize = 2147483647;
EndpointAddress remoteAddress = new EndpointAddress("http://dnna-api-test.azurewebsites.net/AnimalService.svc");
AnimalServiceClient client = new AnimalServiceClient(binding, remoteAddress);
client.ClientCredentials.UserName.UserName = "**********";
client.ClientCredentials.UserName.Password = "*********";
BindingElementCollection elements = client.Endpoint.Binding.CreateBindingElements();
elements.Find<SecurityBindingElement>().IncludeTimestamp = false;
client.Endpoint.Binding = new CustomBinding(elements);
var systems = new string[]
{"28","29","311"};
var _applicationKey = "********-*******-*****-**********************"; //TEST
client.ExecuteLpUpdate(_applicationKey,"",8, Convert.ToDateTime("01/01/2015"), Convert.ToDateTime("02/28/2015"),"me", systems );
Dts.TaskResult = (int)ScriptResults.Success;