Hi all,
I hope someone can help me with my challenge..
I'm new to SSIS and have some troubles with webservices, which I can't seem to solve yet.
I'm using Visual Studio 2010 Shell.
I have an (external) webservice which should give me back a XML file with results (and or a PDF file).
I have the correct url with a WSDL.
I tried to use to Webservice task in SSIS, but I got the error "The selected web method contains unsupported arguments". After some searching I found an alternative in using a Script task.
Unfortunaly I can't get it to work.
I get the following error:
"Exception has been thrown by the target of an invocation
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
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()"
My Visual Basic script 2010 looks like this:
"
#Region "Help: Introduction to the script task"
'The Script Task allows you to perform virtually any operation that can be accomplished in
'a .Net application within the context of an Integration Services control flow.
'Expand the other regions which have "Help" prefixes for examples of specific ways to use
'Integration Services features within this script task.
#End Region
#Region "Imports"
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Imports System.Xml
#End Region
'ScriptMain is the entry point class of the script. Do not change the name, attributes,
'or parent of this class.
<Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute()> _<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#Region "Help: Using Integration Services variables and parameters in a script"
'To use a variable in this script, first ensure that the variable has been added to
'either the list contained in the ReadOnlyVariables property or the list contained in
'the ReadWriteVariables property of this script task, according to whether or not your
'code needs to write to the variable. To add the variable, save this script, close this instance of
'Visual Studio, and update the ReadOnlyVariables and
'ReadWriteVariables properties in the Script Transformation Editor window.
'To use a parameter in this script, follow the same steps. Parameters are always read-only.
'Example of reading from a variable:
' startTime = Dts.Variables("System::StartTime").Value
'Example of writing to a variable:
' Dts.Variables("User::myStringVariable").Value = "new value"
'Example of reading from a package parameter:
' batchId = Dts.Variables("$Package::batchId").Value
'Example of reading from a project parameter:
' batchId = Dts.Variables("$Project::batchId").Value
'Example of reading from a sensitive project parameter:
' batchId = Dts.Variables("$Project::batchId").GetSensitiveValue()
#End Region
#Region "Help: Firing Integration Services events from a script"
'This script task can fire events for logging purposes.
'Example of firing an error event:
' Dts.Events.FireError(18, "Process Values", "Bad value", "", 0)
'Example of firing an information event:
' Dts.Events.FireInformation(3, "Process Values", "Processing has started", "", 0, fireAgain)
'Example of firing a warning event:
' Dts.Events.FireWarning(14, "Process Values", "No values received for input", "", 0)
#End Region
#Region "Help: Using Integration Services connection managers in a script"
'Some types of connection managers can be used in this script task. See the topic
'"Working with Connection Managers Programatically" for details.
'Example of using an ADO.Net connection manager:
' Dim rawConnection As Object = Dts.Connections("Sales DB").AcquireConnection(Dts.Transaction)
' Dim myADONETConnection As SqlConnection = CType(rawConnection, SqlConnection)
' <Use the connection in some code here, then release the connection>
' Dts.Connections("Sales DB").ReleaseConnection(rawConnection)
'Example of using a File connection manager
' Dim rawConnection As Object = Dts.Connections("Prices.zip").AcquireConnection(Dts.Transaction)
' Dim filePath As String = CType(rawConnection, String)
' <Use the connection in some code here, then release the connection>
' Dts.Connections("Prices.zip").ReleaseConnection(rawConnection)
#End Region
'This method is called when this script task executes in the control flow.
'Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'To open Help, press F1.
Public Sub Main()
Dim Request As String = ""
Dim gebruiker As String = "xx"
Dim wachtwoord As String = "xx"
Dim plaats As String = "xx"
Dim bedrijf As String = "xx"
Dim rechtsvorm As String = "xx"
Dim sYear As String = "2012"
Dim KVKnummer As String = ""
Dim sbi As String = "xx"
Dim sString As String = "xx"
Dim Format As String = "FinanXML"
Dim benchmarkID As String = "470"
Dim scale As String = "1"
Dim delivery As String = "false"
Request = Request & "<?xml version='1.0' encoding='utf-8'?>"
Request = Request & "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ben='http://benchmark.webservice.finconnect.finan.nl/'>"
Request = Request & "<soapenv:Header/>"
Request = Request & "<soapenv:Body>"
Request = Request & "<ben:findActiveBenchmarks>"
Request = Request & "<year>" & sYear & "</year>"
Request = Request & "<sbi>" & sbi & "</sbi>"
Request = Request & "</ben:findActiveBenchmarks>"
Request = Request & "</soapenv:Body>"
Request = Request & "</soapenv:Envelope>"
'Create xmlhttp object
Dim xmlhttp As Object = CreateObject("Microsoft.XMLHTTP")
Call xmlhttp.open("POST", "https://benchmarkplatform.sra.nl/finconnect/benchmark", False)
Call xmlhttp.setRequestHeader("Content-Type", "text/xml")
Call xmlhttp.setRequestHeader("SOAPAction", "")
Call xmlhttp.send(Request)
Call MsgBox(xmlhttp.responsetext)
Dim resultaat As String
resultaat = xmlhttp.responseText
resultaat = Replace(resultaat, ">", ">")
resultaat = Replace(resultaat, "<", "<")
resultaat = Replace(resultaat, """, """")
Call MsgBox(resultaat)
Dts.TaskResult = ScriptResults.Success
End Sub
#Region "ScriptResults declaration"
'This enum provides a convenient shorthand within the scope of this class for setting the
'result of the script.
'This code was generated automatically.
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
#End Region
End Class
Can some one help me? What am I doing wrong?
FYI: I already added a Service reference tot de WSDL in the script project.