Buongiorno a tutti,
ho un problema nella chiamata ad un web service esposto da Remedy BMC tramite un programma WinForm in vb 2010. Nello specifico una volta importato in VB il file wsdl e valorizzato non riesco poi a richiamare l'oggetto che "spara" i dati verso il web service.
Vi allego il codice della funzione interessata
codice:
Private Function CreaXL() As Boolean
Dim objconn As OleDbConnection
Dim objcomm As OleDbCommand
Dim strconn As String
Dim strsql As String
Dim valgg As OleDbDataReader
Dim datascar As String
Dim tipoop As String
Dim matric As String
Dim matricola As String
Dim datadec As String
Dim dataces As String
'Dim allinea As New SchemaRemedy.modificaRecordRequest()
'Dim crea As New SchemaRemedy.NuovoRecordRequest()
'Dim nuovo As SchemaRemedy.NuovoRecordRequest()
Dim autentica As New SchemaRemedy.AuthenticationInfo()
Dim EntryID As String
Dim allinea As SchemaRemedy.modificaRecordRequest = New SchemaRemedy.modificaRecordRequest()
Dim crea As SchemaRemedy.NuovoRecordRequest = New SchemaRemedy.NuovoRecordRequest()
'Dim EntryIDN As SchemaRemedy.NuovoRecordResponse
'Dim EntryIDM As SchemaRemedy.modificaRecordRequest
autentica.userName = "Demo"
autentica.password = "dali7"
'user e password del webservice
datascar = DataFile(Now) - 1
matric = vbNullString
matricola = vbNullString
strconn = "Provider=SQLNCLI10;Server=GRANARI-PRT;Database=Differenze; Trusted_Connection=yes;"
objconn = New OleDbConnection(strconn)
objconn.Open()
strsql = "select * from Anagrafica where Datascarico =" + datascar
objcomm = New OleDbCommand(strsql, objconn)
valgg = objcomm.ExecuteReader()
'http://tsfwebsdmh1ltst/arsys/WSDL/public/TSFAPPSDMH1LTST/WS:AnagraficaUtente
While valgg.Read()
tipoop = valgg.GetValue(0)
Select Case tipoop
Case 1 'inserimento
crea.Valido = "1"
matric = Trim(valgg.GetValue(1))
If matric.Substring(0, 1) = "0" Then
If matric.Substring(0, 2) = "00" Then
matricola = matric.Substring(2, 6)
Else
matricola = matric.Substring(1, 7)
End If
End If
crea.Matricola = matricola
crea.Cognome = valgg.GetValue(3)
crea.Nome = valgg.GetValue(4)
crea.Profilo_Anagrafica = valgg.GetValue(5)
datadec = valgg.GetValue(8)
datadec = datadec.Substring(0, 4) & "-" & datadec.Substring(4, 2) & "-" & datadec.Substring(6, 2) & "T00:00:00.00001"
crea.DataDecorrenzaCID = datadec
dataces = valgg.GetValue(9)
If dataces <> "00000000" Then
dataces = dataces.Substring(0, 4) & "-" & dataces.Substring(4, 2) & "-" & dataces.Substring(6, 2) & "T00:00:00.00001"
crea.DataCessazioneCID = dataces
End If
crea.Company = valgg.GetValue(10)
crea.Divisione = valgg.GetValue(11)
crea.Sigla_Sede = valgg.GetValue(12)
crea.Indirizzo_EMail = valgg.GetValue(16)
crea.Unita_Org1 = Trim(valgg.GetValue(17))
crea.Centro_di_Costo = Trim(valgg.GetValue(18))
Dim ritorno As New SchemaRemedy.modificaRecordResponse()
Case 3 ' modifica
allinea.Valido = "1"
matric = Trim(valgg.GetValue(1))
If matric.Substring(0, 1) = "0" Then
If matric.Substring(0, 2) = "00" Then
matricola = matric.Substring(2, 6)
Else
matricola = matric.Substring(1, 7)
End If
End If
allinea.Matricola = matricola
allinea.Cognome = valgg.GetValue(3)
allinea.Nome = valgg.GetValue(4)
allinea.Profilo_Anagrafica = valgg.GetValue(5)
datadec = valgg.GetValue(8)
datadec = datadec.Substring(0, 4) & "-" & datadec.Substring(4, 2) & "-" & datadec.Substring(6, 2) & "T00:00:00.00001"
allinea.DataDecorrenzaCID = datadec
dataces = valgg.GetValue(9)
If dataces <> "00000000" Then
dataces = dataces.Substring(0, 4) & "-" & dataces.Substring(4, 2) & "-" & dataces.Substring(6, 2) & "T00:00:00.00001"
allinea.DataCessazioneCID = dataces
End If
allinea.Company = valgg.GetValue(10)
allinea.Divisione = valgg.GetValue(11)
allinea.Sigla_Sede = valgg.GetValue(12)
allinea.Indirizzo_EMail = valgg.GetValue(16)
allinea.Unita_Org1 = Trim(valgg.GetValue(17))
allinea.Centro_di_Costo = Trim(valgg.GetValue(18))
Case 6 'cessazione
allinea.Valido = "0"
dataces = valgg.GetValue(8)
If dataces <> "00000000" Then
dataces = dataces.Substring(0, 4) & "-" & dataces.Substring(4, 2) & "-" & dataces.Substring(6, 2) & "T00:00:00.00001"
allinea.DataCessazioneCID = dataces
End If
Case tipoop = "7" ' passaggio infragruppo
allinea.Valido = "0"
dataces = valgg.GetValue(8)
If dataces <> "00000000" Then
dataces = dataces.Substring(0, 4) & "-" & dataces.Substring(4, 2) & "-" & dataces.Substring(6, 2) & "T00:00:00.00001"
allinea.DataCessazioneCID = dataces
End If
crea.Valido = "1"
matric = Trim(valgg.GetValue(2))
If matric.Substring(0, 1) = "0" Then
If matric.Substring(0, 2) = "00" Then
matricola = matric.Substring(2, 6)
Else
matricola = matric.Substring(1, 7)
End If
End If
crea.Matricola = matricola
crea.Cognome = valgg.GetValue(3)
crea.Nome = valgg.GetValue(4)
crea.Profilo_Anagrafica = valgg.GetValue(5)
datadec = valgg.GetValue(8)
datadec = datadec.Substring(0, 4) & "-" & datadec.Substring(4, 2) & "-" & datadec.Substring(6, 2) & "T00:00:00.00001"
crea.DataDecorrenzaCID = datadec
dataces = valgg.GetValue(9)
If dataces <> "00000000" Then
dataces = dataces.Substring(0, 4) & "-" & dataces.Substring(4, 2) & "-" & dataces.Substring(6, 2) & "T00:00:00.00001"
crea.DataCessazioneCID = dataces
End If
crea.Company = valgg.GetValue(10)
crea.Divisione = valgg.GetValue(11)
crea.Sigla_Sede = valgg.GetValue(12)
crea.Indirizzo_EMail = valgg.GetValue(16)
crea.Unita_Org1 = Trim(valgg.GetValue(17))
crea.Centro_di_Costo = Trim(valgg.GetValue(18))
End Select
End While
objconn.Close()
End Function
Grazie a chiunque potrà supportarmi.