VB6.0 uses soaptoolkit to access WebService
In VB6.0, how to access a WebService has many instances, which are easy to find. I will not go into detail here. For Setup and usage, see this article "using Microsoft soap Toolkit 2.0 to build a secure web service".
However, there are always many problems in use. The two most common problems are listed below:
1. Use mssoap. soapclient object
This object can support the WSDL of a lower version, but the following error occurs in the WSDL of a higher version:
WebService Access Error wsdlreader: analyzing the WSDL file failed hresult = 0x80004005
-Wsdlreader: initialization of service failed hresult = 0x80004005
-Wsdlservice: initialization of the port for service jaxrpcoutaccessservice failed hresult = 0x80004005
-Wsdlport: Analytic the binding information for port viooutaccess failed hresult = 0x80004005
-Wsdlport: an operation for port viooutaccess cocould not be initialized hresult = 0x80004005
-Wsdloperation: initializing of the input message failed for Operation queryviolet hresult = 0x80004005
-Wsdloperation: initialization of A soapmapper for Operation queryviosurveil failed hresult = 0x80004005
-Soapmapper: The soapmapper for element string cocould not be created hresult = 0x80004005
-Soapmapper: the schema definition with a targetnamespace of http://schemas.xmlsoap.org/soap/encoding/ for soapmapper string cocould not be found hresult = 0x80004005
This problem is generally caused by poor support for soapclient objects with too many WSDL versions. The solution is to replace mssoaplib30.soapclient30 objects.
2. Use the mssoaplib30.soapclient30 object
This version supports a slightly higher WSDL version than mssoaplib. soapclient, but not the latest version. Common Errors of this version are as follows:
WebService Access Error soapmapper: the schema definition with a targetnamespace of http://schemas.xmlsoap.org/soap/encoding/ for soapmapper string cocould not be found hresult = 0x80004005: unspecified error
-Soapmapper: The soapmapper for element string cocould not be created hresult = 0x80004005: unspecified error
-Wsdloperation: initialization of A soapmapper for Operation queryvisurveil failed hresult = 0x80004005: unspecified error
-Wsdloperation: initializing of the input message failed for Operation queryviosurveil hresult = 0x80004005: unspecified error
-Wsdlport: an operation for port viooutaccess cocould not be initialized hresult = 0x80004005: unspecified error
-Wsdlport: analyzing the binding information for port viooutaccess failed hresult = 0x80004005: unspecified error
-Wsdlservice: initialization of the port for service jaxrpcoutaccessservice failed hresult = 0x80004005: unspecified error
-Wsdlreader: analyzing the WSDL file failed hresult = 0x80004005: unspecified error
-Client: one of the parameters supplied is invalid. hresult = 0x80070057: the parameter is incorrect.
2.1 this problem is because the WSDL has less type (the WSDL description can be viewed here), that is
<Types>
<Schema targetnamespace = "http://tempuri.org/xsd"
Xmlns = "http://www.w3.org/2001/XMLSchema"
Xmlns: SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding"
Xmlns: WSDL = "http://schemas.xmlsoap.org/wsdl"
Elementformdefault = "qualified">
</Schema>
</Types>
If WebService is released by itself, you can modify the corresponding part so that the WSDL can be supported by the mssoaplib30.soapclient30 object. Otherwise, you can only build a bridge between the VB6.0 and the later version of WSDL. For example, use. Net to access the WSDL, and then use VB6.0 to call. net.
2.2 another possibility of the previous issue is the question of the WSDL namespace.
For example:
<WSDL: Definitions xmlns: wsdlsoap = "http://schemas.xmlsoap.org/wsdl/soap"
Xmlns: apachesoap = "http://xml.apache.org/xml-soap"
Xmlns: XSD = "http://www.w3.org/2001/XMLSchema"
Xmlns: soapenc = "http://schemas.xmlsoap.org/soap/encoding"
Xmlns: INTF = "http: // xxx/XXX"
Xmlns: impl = "http: // xxx/XXX"
Targetnamespace = "http: // xxx/XXX"
Xmlns: WSDL = "http://schemas.xmlsoap.org/wsdl/">
Xmlns: XSD = "http://www.w3.org/2001/XMLSchema" and xmlns: soapenc = "http://schemas.xmlsoap.org/soap/encoding/" correspond
<WSDL: Message name = "XXX">
<WSDL: part name = "wsxlh" type = "soapenc: string"/>
<WSDL: part name = "xmldoc" type = "soapenc: string"/>
</WSDL: Message>
Type = "soapenc: string ". Now this configuration is generally VB6.0 can not be correctly parsed, if you want to be able to correct the amount of parsing should be xmlns: soapenc = "http://schemas.xmlsoap.org/soap/encoding/" to xmlns: soapenc = "http://www.w3.org/2001/XMLSchema "; or change type = "soapenc: string" to type = "XSD: string ". In this way, VB6.0 can be accessed correctly.
All questions in this area are asked online, but not answered. This article is also the result of my own practice. If there are any errors, I hope you can give me some advice.
PS:
The article references an online article. If the author has any objection, I will immediately remove it.