Webservices and vb6 client

  • Thread starter Jukka Kenttälä
  • Start date
J

Jukka Kenttälä

Hi!

I have a problem with web service that uses private
variables and stores them to context.session. I can call
it from .NET application using cookies or cookieless
session and it works fine. The problem is that when I try
to call it from vb6 client using SOAP I get application-
defined error. The web service is simple, sample code
below:

Private prNumber As Integer

<WebMethod(EnableSession:=True)> Public Function Plus
(ByVal vNumberToAdd As Integer) As String
If Context.Session("Number") Is Nothing Then
prNumber = 0
Else
prNumber = Context.Session("Number")
End If

prNumber += vNumberToAdd
Context.Session("Number") = prNumber
Plus = prNumber
End Function

How can I use this web service from vb6?

Best Regards
Johanna Turku
 
A

Abhuday Aggarwal [MS]

Hi Johanna,

To call a webservice from VB6, you will need to use the Soap Toolkit.
You can download Soap Toolkit 3.0 from
http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-
9753-86F052EC8450&displaylang=en

The user guide installed with the soap toolkit has samples of how to call a
web service.

From a vb6 application, you will have to use code something similar to:
========================================================
Dim soapClient3 As MSSOAPLib30.SoapClient30
Set soapClient3 = New MSSOAPLib30.SoapClient30

Call
soapClient3.mssoapinit("http://servername/SimpleWebService/Service1.asmx?WSD
L")
If Err <> 0 Then
MsgBox "initialization failed " + Err.Description
End If

'Now call the webmethod
soapClient3.WebMethodName()
=========================================================
Note that you will have to take care of the WSDL file location that you
pass to MsSoapInit() call when going up against a .Net web service
This will need to be something like:
"http://servername/SimpleWebService/Service1.asmx?WSDL"

If this doesn't help, please tell us what version of the Soap Toolkit you
are using, and the exact error you are getting.

Thanks,
Abhuday

This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Abhuday Aggarwal [MS]

Hello Johanna,

I was following up on this issue to check you were able to resolve it or if
you had further questions.
Please keep us posted if you are still running into some problems.

Thanks,
Abhuday

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top