0

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
6
  • @Hoorayo: your edit doesn't change anything. You're still passing an array where a single string is expected. Commented Jan 19, 2011 at 3:58
  • "GetServiceTicketList" requires three input parameters which are "UserId", "UserPW", and "Version". But the function takes only a single string. How do I do it? Commented Jan 19, 2011 at 4:17
  • @Hoorayo: you don't. There's obviously something wrong here. The proxy generated by using "Add Web Reference" only gives it a single parameter. Are you sure it takes three? Can you post that part of the WSDL? Commented Jan 19, 2011 at 4:52
  • @John. You are right and it is a string value, "strXMLin". But I just found out "strXMLin" is a XML Tag. I have to create "strXMLin" with those three input parameter. I thought I just need to pass those three parameter, but I need to pass a string as XML Tag. I just need to figure out how to convert those three parameter as XML Tag. Let me know if you have a tutorial link. Commented Jan 19, 2011 at 16:52
  • @Hoorayo: post the XML that is expected, and I can show you how to create it. Commented Jan 19, 2011 at 20:16

1 Answer 1

1

The method is declared to take a single string as a parameter. You are passing it an array of strings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.