0

在 Visual Studio 中,我添加了一个 WSDL Web 参考,它加载了各种用于调用 SOAP api 的“方法”。我有一个空白的 aspx 页面。如何调用 Web 引用加载的这些方法?我已将网络参考称为 mywsdl。

到目前为止,这是我的代码:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>

<%@ Import Namespace="WebApplication1" %>
<%
End Sub
Private Sub Call_Web_Service_Method()
    Dim output
    Dim CallWebService As New ServerName.mywsdl()
    Dim sGetValue As String = CallWebService.GetSomeValue()
    output = sGetValue
End Sub
%>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <%=output%>
    </div>
    </form>
</body>
</html>
4

1 回答 1

1

在网页后面的代码顶部添加 Web 服务作为引用,在需要的地方实例化它的新实例并使用它。当您成功导入 .asmx 我相信这些方法应该已经公开,但是如果您没有取回数据,则可能需要身份验证。

using mywsdl;

mywsdl my = new mywsdl();

或者

Imports mywsdl

Dim my = new mywsdl()
于 2013-02-18T23:28:53.497 回答