简体   繁体   English

在VB.Net中使用XML Web Service

[英]Using XML Web Service with VB.Net

Ok! 好! I just created a VB.Net project and added web reference for other company's XML web service. 我刚刚创建了一个VB.Net项目,并为其他公司的XML Web服务添加了Web参考。 Let's name the web reference as "WebRef". 让我们将网络引用命名为“ WebRef”。 They have provided the web service layout and there is a function named "GetServiceTicketList". 他们提供了Web服务布局,并且有一个名为“ GetServiceTicketList”的函数。 It requires "UserID", "UserPassword", and "ServiceTicketNumber". 它需要“ UserID”,“ UserPassword”和“ ServiceTicketNumber”。

I am trying to get a service ticket list on datagrid with "GetServiceTicketList". 我正在尝试使用“ GetServiceTicketList”在datagrid上获取服务凭单列表。

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" 当我这样做时,我得到一个错误“无法将类型为“字符串的一维数组”的值从“ 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. 您正在传递一个字符串数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM