473,395 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

secure webservice

Hi everyone!

I have built a vb6 app that communicates with a web server to get data from
an webservice through the internet (not lan).

My question/problem is,
1) how could I make this webservice secure, so that only my vb6 app has
access to it and noone else?
Should I use WSE or WCF?
Well ok, but I have completely no idea on how to!

2) Should I enable ssl for this webservice, so that data is encrypted? How?

Please can somebody provide me with info/hints/tips/walkthrough on how to do
this?

Thanks in advance!
Aug 7 '07 #1
2 2399
first of all, thank you very much for the interest!

I have already done the following steps:
(using http://www.codeproject.com/soap/wsse...nametokens.asp as a
guide reference)

Secured my web service using WSE 3.0 and tried to access the web service
using vb6 and soap,
with the following code:

Set g_objSoap = New MSSOAPLib.SoapClient
With g_objSoap
.mssoapinit http://ticketinsrv/dbws/service.asmx?WSDL
.ConnectorProperty("AuthUser") = "wsuser"
.ConnectorProperty("AuthPassword") = "pass"
End With
However I get either "access denied" (line:

.mssoapinit http://ticketinsrv/dbws/service.asmx?WSDL)

or access denied when trying to execute any method,

e.g. the following (test) one:

<WebMethod()_
Public Function Hello() As String

' Get the current soap context
Dim ctxt As SoapContext = RequestSoapContext.Current
If ctxt Is Nothing Then
' This request is using a different protocol other than SOAP.
Return "Please format the request as a SOAP request and try again."
End If

' Iterate through all Security tokens
For Each tok As SecurityToken In ctxt.Security.Tokens
If TypeOf (tok) Is UsernameToken Then
Dim user As UsernameToken = CType(tok, UsernameToken)
Return "Hello Authenticated user " + user.Username
End If
Next tok
Return "Hello Liar"

End Function

Also, my customauthenticator class (referenced from the web service) is as
follows:

Imports System
Imports System.Security.Permissions
Imports Microsoft.Web.Services3.Security.Tokens

Namespace WSESecurity
<SecurityPermissionAttribute(SecurityAction.Demand )_
Public Class CustomAuthenticator
Inherits UsernameTokenManager

' Returns the password or password equivalent for a user name
Protected Overrides Function AuthenticateToken(ByVal token As
UsernameToken) As String

If token Is Nothing Then
Throw New ArgumentNullException()
End If

' perform a lookup in your database
' for the user name in 'token.Username'
' and return the password as a string.
' If there is no match, return null.
If token.Username = "wstest" Then
Return "pass"
Else
Return Nothing
End If

End Function
End Class
End Namespace

I can't figure out WTH goes wrong, so please, if anyone has any
idea/tips/suggestions please please HELP me!

(It's my first time writing a secure web service - newbie on the subject)
Aug 8 '07 #2
I have already done the following steps:
(using http://www.codeproject.com/soap/wsse...nametokens.asp as a
guide reference)

Secured my web service using WSE 3.0 and tried to access the web service
using vb6 and soap,
with the following code:

Set g_objSoap = New MSSOAPLib.SoapClient
With g_objSoap
.mssoapinit http://ticketinsrv/dbws/service.asmx?WSDL
.ConnectorProperty("AuthUser") = "wsuser"
.ConnectorProperty("AuthPassword") = "pass"
End With
However I get either "access denied" (line:

.mssoapinit http://ticketinsrv/dbws/service.asmx?WSDL)

or access denied when trying to execute any method,

e.g. the following (test) one:

<WebMethod()_
Public Function Hello() As String

' Get the current soap context
Dim ctxt As SoapContext = RequestSoapContext.Current
If ctxt Is Nothing Then
' This request is using a different protocol other than SOAP.
Return "Please format the request as a SOAP request and try again."
End If

' Iterate through all Security tokens
For Each tok As SecurityToken In ctxt.Security.Tokens
If TypeOf (tok) Is UsernameToken Then
Dim user As UsernameToken = CType(tok, UsernameToken)
Return "Hello Authenticated user " + user.Username
End If
Next tok
Return "Hello Liar"

End Function

Also, my customauthenticator class (referenced from the web service) is as
follows:

Imports System
Imports System.Security.Permissions
Imports Microsoft.Web.Services3.Security.Tokens

Namespace WSESecurity
<SecurityPermissionAttribute(SecurityAction.Demand )_
Public Class CustomAuthenticator
Inherits UsernameTokenManager

' Returns the password or password equivalent for a user name
Protected Overrides Function AuthenticateToken(ByVal token As
UsernameToken) As String

If token Is Nothing Then
Throw New ArgumentNullException()
End If

' perform a lookup in your database
' for the user name in 'token.Username'
' and return the password as a string.
' If there is no match, return null.
If token.Username = "wstest" Then
Return "pass"
Else
Return Nothing
End If

End Function
End Class
End Namespace

I can't figure out WTH goes wrong, so please, if anyone has any
idea/tips/suggestions please please HELP me!

(It's my first time writing a secure web service - newbie on the subject)
Aug 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt Sollars | last post by:
I've struggled with this problem, and it's lack of examples, for a couple of months now. On several different web applications that we have written, we need to communicate with a credit card...
1
by: Shelby | last post by:
Hi, I'm doing some research on webservices using 2 way SSL. It is Application-to-Application security. Basically SERVER_SAP is hosting the webservice and SERVER_CLIENT is consuming the...
3
by: Kevin Rose | last post by:
I can't decide what level of risk we are taking by using ASP.NET Request.QueryString. We have a web page that will have an data "posted" to it by partner company. The data is passed via the...
0
by: newjazzharmony | last post by:
We have both Windows and Linux webservers in our organization. I know that WSE 3.0 allows you to secure a web service with Kerberos such that an authenticated NT user can be recognized by the...
2
by: thomas | last post by:
Hi everybody, Here is the scenario: webservice and a windows client application. Requirements: 1. Only authenticated and authorized users shall be able to call web methods. 2. User names or...
3
by: UJ | last post by:
Is there a way to tell when a webservice is called whether it came in through HTTP or HTTPS ? TIA - Jeff.
0
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System;...
6
by: =?Utf-8?B?SWJyYWhpbS4=?= | last post by:
Hi, I have a client application which Accesses Web Service. but the Web service allows anonymous access to any client request (web/smart client). I want to authenticate every client request by...
0
by: =?Utf-8?B?VFRL?= | last post by:
I have a vb.net web service. I am trying to call another webservice that is secured through certificate. I have received the certificate file and I am trying to call the service using the file. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.