471,575 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

VB.NET Webservice Client - NOT to use SOAP Toolkit 3


I have a successful VB6 web service client that uses the SOAP Toolkit 3
to make calls to a web service written in ASP.Net (VB.Net). However,
due to Microsoft not recommending the use of SOAP Toolkit 3 on a
Windows 2003 server, I must scrap the use of the toolkit and look to
develop the client in VB.Net instead.

I have upgraded the VB6 application to VB.Net using the built-in
upgrade tool that comes with Visual Studio .Net 2003. The majority of
the code has been translated to .Net, but I am having trouble as the
SOAP Toolkit 3 code has also been translated to VB.Net.

I have successfully called the web service to return very simple
values, where I do not actually need to use objects such as:
WSDLReader30, SoapSerializer30, SoapReader30, SoapConnector30 that are
required in the VB6 application. Am I correct to assume this??

I would appreciate if someone could advise me on how I should tackle
translating the following VB6 function that uses SOAP Toolkit 3.

The VB6 function is as follows:

Private Function ExecuteSOAP(aOperation() As String, xmlparams As
IXMLDOMNode, bErrorOnNoSOAP As Boolean) As SoapReader30

Dim WSDLReader As New WSDLReader30
Dim serializer As SoapSerializer30
Dim Reader As New SoapReader30
Dim Connector As New SoapConnector30
Dim ServiceEnumerator As IEnumWSDLService, Service As IWSDLService
Dim Fetched As Long
Dim PortEnumerator As IEnumWSDLPorts, Port As IWSDLPort
Dim OperationEnumerator As IEnumWSDLOperations, Operation As
Dim MapperEnumerator As IEnumSoapMappers, Mapper As ISoapMapper
Dim bFoundOperation As Boolean
Dim XMLElement As IXMLDOMNode

'read WSDL file
On Error GoTo ErrorHandler

WSDLReader.Load gWSDL, ""

' Loop round the services
WSDLReader.GetSoapServices ServiceEnumerator
ServiceEnumerator.Next 1, Service, Fetched
Do While Fetched = 1 And bFoundOperation = False

' Loop round the ports
Service.GetSoapPorts PortEnumerator
PortEnumerator.Next 1, Port, Fetched
Do While Fetched = 1 And bFoundOperation = False

' find the operation
Port.GetSoapOperations OperationEnumerator

' The Find method returns an error if it fails so trap it
and continue
Set Operation = Nothing
On Error Resume Next
OperationEnumerator.Find aOperation(1), Operation
On Error GoTo ErrorHandler

If Not Operation Is Nothing Then
' prepare request
bFoundOperation = True
Set MapperEnumerator =

MapperEnumerator.Next 1, Mapper, Fetched
Do While Fetched = 1
'See if this is a complex type. The SchemaNode
property is nothing if simple type
If Mapper.SchemaNode Is Nothing Then
' simple type, just get the parameter from the
input xml file
If Not xmlparams.selectSingleNode("//" &
Mapper.ElementName) Is Nothing Then
Mapper.ComValue =
xmlparams.selectSingleNode("//" & Mapper.ElementName).Text
Mapper.ComValue = ""
End If
'complex type, use the whole node from the
input xml file
Mapper.ComValue = ""
If Not xmlparams.selectSingleNode("//" &
Mapper.ElementName) Is Nothing Then
'Mapper.ComValue =
xmlparams.selectSingleNode("//" & Mapper.ElementName).xml
For Each XMLElement In
xmlparams.selectSingleNode("//" & Mapper.ElementName).childNodes
Mapper.ComValue = Mapper.ComValue &
End If
End If
MapperEnumerator.Next 1, Mapper, Fetched

End If

If bFoundOperation = False Then PortEnumerator.Next 1,
Port, Fetched

If bFoundOperation = False Then ServiceEnumerator.Next 1,
Service, Fetched

If bFoundOperation = False Then
Set ExecuteSOAP = Nothing
Set Connector = New HttpConnector30

strDebugPoint = "Connecting to port '" & Port.Address & "'"
Connector.ConnectWSDL Port

Connector.BeginMessageWSDL Operation

Set serializer = New SoapSerializer30
serializer.Init Connector.InputStream


Operation.Save serializer, True


' Force the message to appear on the screen



Reader.Load Connector.OutputStream

Set ExecuteSOAP = Reader
End If
Exit Function
Many thanks.


Jan 24 '06 #1
0 4416

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Q. John Chen | last post: by
1 post views Thread by Vincenzo Milazzo | last post: by
1 post views Thread by NN | last post: by
reply views Thread by XIAOLAOHU | last post: by
1 post views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

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.