Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > simple problem setting up the security on my test web service

Reply
Thread Tools

simple problem setting up the security on my test web service

 
 
Greg
Guest
Posts: n/a
 
      12-11-2004
I am having a simple problem setting up the security on my test web
service...

My Web service code is:

Imports System.Web.Services
<System.Web.Services.WebService(Namespace :=
"http://tempuri.org/AddNumbersWebService/AddNumbersWebService")> _
Public Class AddNumbersWebService
Inherits System.Web.Services.WebService
#Region " Web Services Designer Generated Code "
<WebMethod()> _
Public Function AddNumbers( ByVal a1 As Integer, _
ByVal a2 As Integer) As String
Dim lResult As String = (A1+A2).ToString
Return lResult
End Function
End Class

This works fine when I test it using F5, it fires up a web page where
I can test the web service. But when I try to write a client
program...

Private Sub DoIt
Try
TextBox3.Text = "Processing"
Application.DoEvents
Dim lV1 As String = TextBox1.Text
Dim lV2 As String = TextBox2.Text
Dim lV1a As Integer = 0
Dim lV2a As Integer = 0
If IsNumeric( lV1 ) Then lV1a = Int( lV1 )
If IsNumeric( lV2 ) Then lV2a = Int( lV2 )
Dim lWebService As New
WebServiceClient.localhost.AddNumbersWebService
Dim lResult As String = lWebService.AddNumbers(lV1a,lV2a)
TextBox3.Text = lResult
Catch ex As Exception
TextBox3.Text = ex.Message
End Try
End Sub

I get the error "The request failed with HTTP status 401: Access
Denied." from the line:
Dim lResult As String = lWebService.AddNumbers(lV1a,lV2a)

I think this is a simple setup problem with the IIS security settings
but I cannot figure it out. Any help would be appreciated.

The environment is:
Running on local host.
VB2003.
MS Windows-XP (SP1)
For the web service:
- anonymous access is allowed.
- Execute permissions = Scripts and executables
- Application protection = Low

Thanks in advance for your help
Greg

p.s. the reference.vb file contains...
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by Microsoft.VSDesigner, Version
1.1.4322.573.
'
Namespace localhost1

'<remarks/>
<System.Diagnostics.DebuggerStepThroughAttribute() , _
System.ComponentModel.DesignerCategoryAttribute("c ode"), _
System.Web.Services.WebServiceBindingAttribute(Nam e:="AddNumbersWebServiceSoap",
[Namespace]:="http://tempuri.org/AddNumbersWebService/AddNumbersWebService")>
_
Public Class AddNumbersWebService
Inherits System.Web.Services.Protocols.SoapHttpClientProtoc ol

'<remarks/>
Public Sub New()
MyBase.New
Me.Url =
"http://localhost/AddNumbersWebService/AddNumbersWebService.asmx"
End Sub

'<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://tempuri.org/AddNumbersWebService/AddNumbersWebService/AddNumbers",
RequestNamespace:="http://tempuri.org/AddNumbersWebService/AddNumbersWebService",
ResponseNamespace:="http://tempuri.org/AddNumbersWebService/AddNumbersWebService",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function AddNumbers(ByVal a1 As Integer, ByVal a2 As
Integer) As String
Dim results() As Object = Me.Invoke("AddNumbers", New
Object() {a1, a2})
Return CType(results(0),String)
End Function

'<remarks/>
Public Function BeginAddNumbers(ByVal a1 As Integer, ByVal a2
As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState
As Object) As System.IAsyncResult
Return Me.BeginInvoke("AddNumbers", New Object() {a1, a2},
callback, asyncState)
End Function

'<remarks/>
Public Function EndAddNumbers(ByVal asyncResult As
System.IAsyncResult) As String
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0),String)
End Function
End Class
End Namespace
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Can I use Application Center Test for web service stress test? A.M-SG ASP .Net Web Services 4 10-06-2005 01:02 AM
Solved - problem setting up the security on my test web service - Thanks Greg ASP .Net Web Services 0 12-13-2004 08:54 PM
Web Service: Uploading files and setting file security on a file server wym ASP .Net Web Services 0 04-26-2004 02:02 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57