Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a webservice with VB6

Status
Not open for further replies.

kalwijro

Programmer
Aug 13, 2001
12
NL
Does anyone know if it's possible to use a webservice with a VB6 com object, or do I have to switch to VB dotnet?
If it is possible with VB6: how?, what do I need?

Thanks a lot.
 
You can do it - I'm not an expert but I was able to do it using the SOAP toolkit and a WSDL file.

This is a bit of the code that was used:

Public Function errSend(strApplication As String, strMethod As String, strDescription As String, nSeverity As Integer) As Boolean
' send error-message data to a remote web-service.
' [strApplication] the application where the error occurred.
' [strMethod] the method where the error occurred.
' [strDescription] description of the error.
' [nSeverity] severity of error: 0, 1, 2, 3 (critical).
' Return value:
' Boolean returned by the Request method of remote web-service.
' Remarks: sends 8 items of data to web-service: 4 are passed
' in as parameters and passed on, 3 are obtained from
' the system and 1 is a vehicle for receiving back
' any errors in the invocation of the web-service itself.
Rem variables for web-service call
Dim bReturnValue As Boolean
Dim dteNow As Date
Dim strComputerName As String
Dim strUserID As String
Dim strError As String

Rem get local system environment data

Rem get the current date and time
dteNow = Now()

Rem create a new System-Environment object
Dim oSystemEnv As New clsSystemEnv

Rem Get the hostname and user ID.
strComputerName = oSystemEnv.getComputerName()
strUserID = oSystemEnv.getUserID()

Rem Use high-level interface to MS SOAP Toolkit.
Rem Invoke service named "Service", with port-type "ServiceSoap"
Rem and using local copy of the interface-definition, "service.wsdl".
Dim oSoapClient As New MSSOAPLib.SoapClient
oSoapClient.mssoapinit "CorporateError.wsdl", "Service", "ServiceSoap", ""

Rem Call method "Request" on the web-service.
Rem Pass 4 parameters passed into this method by caller.
Rem Pass 3 items of data obtained from system.
Rem Pass strError to be filled with an error-message
Rem by the web-service itself, should it fail somehow.
bReturnValue = oSoapClient.Request(strApplication, strMethod, strDescription, nSeverity, dteNow, strComputerName, strUserID, strError)

errSend = bReturnValue

End Function
 
Thanks TomKane

I'm shall try it as soon as possible and will let you know the outcome.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top