Ok! I just created a VB.Net project and added web reference for other company's XML web service. Let's name the web reference as "WebRef". They have provided the web service layout and there is a function named "GetServiceTicketList". It requires "UserID", "UserPassword", and "ServiceTicketNumber".
I am trying to get a service ticket list on datagrid with "GetServiceTicketList".
When I do this, then I get a error "Value of type '1-dimensional array of String' cannot be converted to 'String' from "ls_ParamValue"
Public Function GetTicketList(ByVal strXMLin As String) As String开发者_开发技巧
Dim results() As Object = Me.Invoke("GetServiceTicketList", New Object() {strXMLin})
Return CType(results(0),String)
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Client As WebRef.service1 = New WebRef.service1
Dim XMLResoponse As String
Dim UserId As String = "SuperMan"
Dim UserPW As String = "Batman"
Dim Version As String = "1234"
Dim ls_ParamValue As String()
ls_ParamValue = {UserId, UserPW, Version}
XMLResoponse = Client.GetServiceTicketList(ls_ParamValue)
End Sub
The method is declared to take a single string as a parameter. You are passing it an array of strings.
精彩评论