M
Matt
I am new to web service. My goal is to create a simple web service, and a
web service client to test the web service.
When I created a web services, HelloWorld() method is generated
automatically and I use it for testing purpose.
http://localhost/WebService1/Service1.asmx is the web service URL. When I
test it in the browser, it works fine.
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
For the web service client, I created an ASP.NET application. And I added
web reference http://localhost/WebService1/Service1.asmx to the project.
Basically the web service client just invoke HelloWorld() method and return
the string to the TextBox1 web control in ASP.NET application.
Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit1.ServerClick
Dim c As New localhost.Service1
Dim s As String = c.HelloWorld
TextBox1.Text = s.ToString
End Sub
However, when I run the web service client ASP.NET application, it throws
401 run-time error. Any ideas??
The request failed with HTTP status 401: Access Denied.
Line 40:
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.o
rg/WebService1/Service1/HelloWorld",
RequestNamespace:="http://tempuri.org/WebService1/Service1",
ResponseNamespace:="http://tempuri.org/WebService1/Service1",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_
Line 41: Public Function HelloWorld() As String
Line 42: Dim results() As Object = Me.Invoke("HelloWorld", New
Object(-1) {})
Line 43: Return CType(results(0),String)
Line 44: End Function
web service client to test the web service.
When I created a web services, HelloWorld() method is generated
automatically and I use it for testing purpose.
http://localhost/WebService1/Service1.asmx is the web service URL. When I
test it in the browser, it works fine.
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
For the web service client, I created an ASP.NET application. And I added
web reference http://localhost/WebService1/Service1.asmx to the project.
Basically the web service client just invoke HelloWorld() method and return
the string to the TextBox1 web control in ASP.NET application.
Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit1.ServerClick
Dim c As New localhost.Service1
Dim s As String = c.HelloWorld
TextBox1.Text = s.ToString
End Sub
However, when I run the web service client ASP.NET application, it throws
401 run-time error. Any ideas??
The request failed with HTTP status 401: Access Denied.
Line 40:
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.o
rg/WebService1/Service1/HelloWorld",
RequestNamespace:="http://tempuri.org/WebService1/Service1",
ResponseNamespace:="http://tempuri.org/WebService1/Service1",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_
Line 41: Public Function HelloWorld() As String
Line 42: Dim results() As Object = Me.Invoke("HelloWorld", New
Object(-1) {})
Line 43: Return CType(results(0),String)
Line 44: End Function