在visual Studio中,我添加了一个WSDL Web引用,它加载了用于调用SOAP API的各种“方法”。我有一个空白的aspx页面。如何调用Web引用加载的这些方法?我称之为web引用mywsdl。使用ASPX调用Web引用页面
这里是我到目前为止的代码:
<%@ 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>
你没有使用服务引用任何理由吗? Web引用是传统ASMX Web服务技术的一部分,不应该用于新开发。 – 2013-02-19 01:42:39
你如何用wsdl做服务引用? – 2013-02-19 02:09:51
咦?这就是你的服务参考!只需使用“添加服务引用”,并输入WSDL的URL即可。 – 2013-02-19 02:19:47