shyam kumar

shyam kumar

  • NA
  • 17
  • 0

Problem while Accessing .Net web service Array in Lotus notes

Mar 13 2009 1:00 AM

hello guyz,

               i have developed a .net web service written in vb.net which returns a string array.
i have given the url to one of my client who is using Lotus Notes, from where he  has to consume my web service. The problem is he is not able to retrieve my string arrays.

My question is do  need to change my web service that should be compatible with lotus notes. if my knowledge is right Web services are platform independent, language independent technologies.

i will give u my web service code  below,

  <WebMethod()> _
     Public Function fnGetClientDataByClientID(ByVal ClientID As Integer) As String()

        Dim strResult(9) As String
        Dim ds As New DataSet
        Dim dad As SqlDataAdapter
        Try
            Dim con As SqlConnection
            Dim strCon As String =            System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString1").ToString()

            con = New SqlConnection(strCon)
            If con.State = ConnectionState.Open Then
            Else
                con.Open()
            End If
            Dim cmd As SqlCommand

            cmd = New SqlCommand("sp_GetClientByClientID", con)
            cmd.CommandType = CommandType.StoredProcedure

            Dim param1 As SqlParameter = New SqlParameter()
            param1.ParameterName = "@ClientID"
            param1.DbType = DbType.Int32
            param1.Size = 30
            param1.Direction = ParameterDirection.Input
            param1.Value = CInt(ClientID.ToString().Trim())

            Dim param2 As SqlParameter = New SqlParameter()
            param2.ParameterName = "@Result"
            param2.DbType = DbType.String
            param2.Size = 50
            param2.Direction = ParameterDirection.Output
            param2.Value = "Result"

            cmd.Parameters.Add(param1)
            cmd.Parameters.Add(param2)

            dad = New SqlDataAdapter(cmd)

            dad.Fill(ds)

            If ds.Tables.Count <> 0 Then

                If (ds.Tables(0).Rows.Count <> 0) Then

                    'ReDim strResult(CInt(ds.Tables(0).Rows.Count) - 1)

                    For i As Integer = 0 To CInt(ds.Tables(0).Rows.Count) - 1

                        strResult(0) = ds.Tables(0).Rows(0)("Name").ToString().Trim()
                        strResult(1) = ds.Tables(0).Rows(0)("Address1").ToString().Trim()
                        strResult(2) = ds.Tables(0).Rows(0)("City").ToString().Trim()
                        strResult(3) = ds.Tables(0).Rows(0)("Accounting_Type").ToString().Trim()
                        strResult(4) = ds.Tables(0).Rows(i)("Sales Office").ToString().Trim()
                        strResult(5) = ds.Tables(0).Rows(i)("Domiliciation Office").ToString().Trim()
                        strResult(6) = ds.Tables(0).Rows(i)("Relationship Office").ToString().Trim()
                        strResult(7) = ds.Tables(0).Rows(i)("RelationshipManager").ToString().Trim()
                        strResult(8) = ds.Tables(0).Rows(i)("Accountingmanager").ToString().Trim()
                        strResult(9) = Convert.ToDateTime(ds.Tables(0).Rows(i)("Last_Entry_Date").ToString()).Date()
                    Next

                Else

                    ReDim strResult(0)
                    strResult(0) = "No Data"
                End If
            Else

                ReDim strResult(0)

                strResult(0) = "No Data"

            End If


        Catch ex As Exception
            ErrorHandler.WriteError("Error in fnGetClientDataByClientID")
            ErrorHandler.WriteError(ex.Message.ToString())

        End Try

        Return strResult
    End Function



guyz, suggest me, do i need to change anything here



thanks in advance

shyam