Integrating WCF web services in script task
I have tried so many different ways to integrate my WFC web services into and SSIS script task, I have tried importing my DLL as well as adding a web service reference and I am not able to get it to work. dos some have a full working example they <g class="gr_ gr_238 gr-alert gr_gramm Grammar multiReplace" data-gr-id="238" id="238">be</g> willing to share. I know my services are working since I created a quick windows form application and I was able to connect and execute the web services. the part that I am most concerned about is how do I implement the configuration settings that I specify on my app.config (services.serviceMode><client> <binding> etc... )  I tried to implement a binding on my <g class="gr_ gr_653 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="653" id="653">ssis</g> script task but no luck. Thanks in advance.
September 11th, 2015 4:24pm

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

Free Windows Admin Tool Kit Click here and download it now
September 11th, 2015 4:54pm

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()

September 14th, 2015 2:22pm

Service incompatible.

E.g. the .net framework versions used in it and the VS 2012 to target SSIS 2012

Free Windows Admin Tool Kit Click here and download it now
September 14th, 2015 2:46pm

what version should it be set to?   the default for SSIS 2012 is 4.0. and that's what I am using? 
September 14th, 2015 3:50pm

You need to inspect what .net runtime your webservice reference (DLL) is based and you may need then decide to manipulate on the versions, there is more help in this blog post http://microsoft-ssis.blogspot.ca/2012/05/changing-net-framework-version-in-ssis.html
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2015 4:26pm

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;

September 14th, 2015 7:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics