Link to home
Start Free TrialLog in
Avatar of Knowledge-Dimension
Knowledge-Dimension

asked on

Consuming a web service with authentication

I am involved in a project where I have to consume a web service....

I am very new to web services and have limited knowledge on this subject.
I desperately need help.
The web service provider has given us the following vb.net code , but I have no idea how to adapt it to work in LotusScript ....

Please can you assist me in any way.... Here is the code :

Try
            Dim sVendorCode, sApplicationKey As String

            sVendorCode = txtVendor.Text
            sApplicationKey = txtAppKey.Text

            Dim oHS As New Handshake.Handshake

            Dim oAS As New AddressService.AddressService
            oAS.Url = ConfigurationSettings.AppSettings("WSUrl")
            oHS.Url = oAS.GetURL("Handshake")

            txtVendorToken.Text = oHS.GetToken(sVendorCode, sApplicationKey)
        Catch ex As Exception
            txtOutput.Text = ex.Message.ToString()
        End Try

There is a second part where we login :
Try
            Dim sVendorCode, sApplicationKey As String

            Dim oHS As New Handshake.Handshake

            Dim oAS As New AddressService.AddressService
            oAS.Url = ConfigurationSettings.AppSettings("WSUrl")
            oHS.Url = oAS.GetURL("Handshake")

            Dim sLoginStatus, sMessage As String

            txtUserToken.Text = oHS.Login(txtVendor.Text, txtAccessKey.Text, txtAppKey.Text, sLoginStatus, sMessage)
            txtLoginStatus.Text = sLoginStatus

            txtOutput.Text = sMessage

        Catch ex As Exception
            txtOutput.Text = ex.Message.ToString()
        End Try
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Knowledge-Dimension
Knowledge-Dimension

ASKER

Hi Bill....

That sounds like that way the company supplying the web service said we should try to do it , but I have no clue how to get that done.... I am practially an idiot when it comes to COM and using VB.net.
Also, Thanks for the other replies , but those dont explain how I authenticate with the server.... There are apparently 2 things that need to happen before we can execute/comsume the web service, we have to pass parameters to a function exposed , get a token and then with the token , encrypt the token , login name and password to create  a key and with that key , call a login function to get a user token , thereafter , we are authenticated. Now I have no clue what all of that means or how to get it done.......... can you help me....


Please can you help me with any sample code. Thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Each web service functions a little differently, so how you authenticate will depend on the web service's API.

The best source for writing the .Net app is normally directly from the web service provider.  They should have .Net project examples that you can load into .Net and run without modification.  From there, you can extend the examples to meet your needs.

To make a .Net application into a COM server, you just need to tell the assembly that it should expose the public class members to COM.  To do this...

(1) Right-click on the project node in the "Solution Explorer" and choose "Properties".
(2) On the Properties screen, select the "Application" tab, then click the "Assembly Information..." button.
(3) On the Assembly Information screen, check the "Make assembly COM-Visible" box and click "OK".
(4) On the Properties screen, select the "Build" tab.  Scroll to the bottom of the Built tab page and check the "Register for COM interop" box.
(5) Save and close the Properties screen.
Forced accept.

Computer101
EE Admin