Mike
Mike

Reputation: 441

Deserialize SOAP message in VB6 - SoapClient30 MS SOAP Type library

NET Web Service from VB6. In VB6 I use SoapClient30 (MS SOAP Type library).

Web method has this signature:

[WebMethod]
public List<List<string>> SomeMethod(string [] args){}

Its return XML in SOAP like this:

<?xml version="1.0" encoding="utf-8" ?> 
<ArrayOfArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://icz.sk/">
  <ArrayOfString>
  <string>1</string> 
  <string>2</string> 
  <string>3</string> 
  <string>4</string> 
  <string>5</string> 
  </ArrayOfString>
  <ArrayOfString>
  <string>1</string> 
  <string>2</string> 
  <string>3</string> 
  <string>4</string> 
  <string>5</string> 
  </ArrayOfString>
</ArrayOfArrayOfString>

For initialization of SoapClient30 I use WSDL.

When I call web method on top I got in VB6 this exception:

SoapMapper:Restoring data into SoapMapper ArrayOfString failed HRESULT=0x8007000E

SoapMapper:Restoring data into SoapMapper SomeMethod failed HRESULT=0x8007000E

Client:Unspecified client error. HRESULT=0x8007000E:

I think SoapClient30 doesn’t know deserialize XML response to VB6 code.

I try save web method result in Variant.

Private proxy As SoapClient30
Dim result As Variant
Dim input_param(0 To 2) As String

proxy.MSSoapInit WSDL_PATH

input_param(0) = arg1 
input_param(1) = arg2
input_param(2) = ""

result = proxy.SomeMethod()

What is need change response fomat of web method or type for store response in VB6?

I must use SOAP Type library I can use COM. Thank you for responses

Upvotes: 0

Views: 2651

Answers (2)

Carlos Cocom
Carlos Cocom

Reputation: 932

Vb6 is really old and not way natively work with webservices in my case i do direct call to web service, look at here Problems with Visual Basic 6.0 and MagentoSoap you can then change from string to custom object

Upvotes: 0

John Saunders
John Saunders

Reputation: 161821

The SoapClient library is obsolete and should not be used.

Fortunately, it is not your only choice for consuming a web service in VB6 code. VB6 can use any reasonable COM component. I recommend you create a COM component in C# to consume your service. You can use the normal "Add Service Reference" to consume the service, then expose the service calls as methods on the COM object.

This way, the only obsolete code you're depending on is VB6 itself.

Upvotes: 1

Related Questions