惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
SecWiki News
SecWiki News
Know Your Adversary
Know Your Adversary
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
NISL@THU
NISL@THU
WordPress大学
WordPress大学
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Threat Research - Cisco Blogs
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
Security Archives - TechRepublic
Security Archives - TechRepublic
有赞技术团队
有赞技术团队
L
LINUX DO - 热门话题
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
G
GRAHAM CLULEY
TaoSecurity Blog
TaoSecurity Blog
Hugging Face - Blog
Hugging Face - Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
F
Fortinet All Blogs
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
Latest news
Latest news
The Hacker News
The Hacker News
aimingoo的专栏
aimingoo的专栏
T
Troy Hunt's Blog
S
Schneier on Security
I
Intezer
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
爱范儿
爱范儿
The Register - Security
The Register - Security
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
美团技术团队
B
Blog RSS Feed

博客园 - syuko

【转】IE8 松散耦合进程框架探索 【转】Windows 文件夹的秘密:Windows 目录到底占用了多少真实的硬盘空间 【转】d:DesignInstance, d:DesignData in Visual Studio 2010 Beta2 RadTreeView:How to Get Item by Path RadTreeViewItem - event MouseLeftButtonDown or Up never fires visual studio 2005 中的部署 产生“不可恢复的生成错误” Windows 7使用记事及琐事流水帐-职称英语考试始末记事 Oracle难道不能处理大数据并发的问题 [转载]DNS解析错误解决办法 鼠标(Mouse)的复数问题告诉我们治学要严谨 Just for Fun-生存,社会秩序,娱乐 软件创作 [转] oracle rownum 探析 用MSIL来写一个“Hello World” 天地生人,有一人莫不有一人之业;人生在世,有一日当尽一日之勤 小窥黄鹤楼 JavaScript基础之继承(二) JavaScript基础之继承(附实例) JavaScript基础之对象
VB6.0通过SoapToolkit访问WebService问题
syuko · 2009-04-27 · via 博客园 - syuko

VB6.0通过SoapToolkit访问WebService

    在VB6.0中怎么去访问一个WebService网上有很多的实例,大家很容易搜到,这里就不细说了。架设和使用可以看看这篇文章《使用 Microsoft SOAP Toolkit 2.0 建立安全 Web 服务 》。

    但在使用时总会遇到很多的问题。先收录两种最常见的问题如下:

    1 使用MSSoap.SoapClient对象

    该对象对低版本的WSDL能够支持,但遇到高版本的WSDL就会出现以下的错误:

      访问WebService错误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:Analyzing the binding information for port VioOutAccess failed HRESULT=0x80004005 
      - WSDLPort:An operation for port VioOutAccess could not be initialized HRESULT=0x80004005 
      - WSDLOperation:Initializing of the input message failed for operation queryVioSurveil HRESULT=0x80004005 
      - WSDLOperation:Initialization of a SoapMapper for operation queryVioSurveil failed HRESULT=0x80004005 
      - SoapMapper:The SoapMapper for element string could not be created HRESULT=0x80004005 
      - SoapMapper:The schema definition with a targetnamespace of http://schemas.xmlsoap.org/soap/encoding/ for SoapMapper string could not be found HRESULT=0x80004005

      这个问题一般是因为WSDL版本太高soapclient对象支持不好造成的,解决办法就是换用MSSOAPLib30.SoapClient30对象。

      2 使用MSSOAPLib30.SoapClient30对象

      该版本支持的WSDL版本较MSSOAPLib.SoapClient略高,但最新的版本也是不支持的。该版本常见的错误如下:

      访问WebService错误SoapMapper:The schema definition with a targetnamespace of http://schemas.xmlsoap.org/soap/encoding/ for SoapMapper string could not be found HRESULT=0x80004005: 未指定的错误
       - SoapMapper:The SoapMapper for element string could not be created HRESULT=0x80004005: 未指定的错误
       - WSDLOperation:Initialization of a SoapMapper for operation queryVioSurveil failed HRESULT=0x80004005: 未指定的错误
       - WSDLOperation:Initializing of the input message failed for operation queryVioSurveil HRESULT=0x80004005: 未指定的错误
       - WSDLPort:An operation for port VioOutAccess could not be initialized HRESULT=0x80004005: 未指定的错误
       - WSDLPort:Analyzing the binding information for port VioOutAccess failed HRESULT=0x80004005: 未指定的错误
       - WSDLService:Initialization of the port for service JaxRpcOutAccessService failed HRESULT=0x80004005: 未指定的错误
       - WSDLReader:Analyzing the WSDL file failed HRESULT=0x80004005: 未指定的错误
       - Client:One of the parameters supplied is invalid. HRESULT=0x80070057: 参数不正确。

      2.1 这个问题是因为,WSDL少type(WSDL描述可以看看这里),就是

      <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> 

      如果WebService是自己发布的话则可以修改相应的部分使WSDL能够被MSSOAPLib30.SoapClient30对象所支持,否则就只能在VB6.0和高版本的WSDL之间建立一个桥梁。比如用.net访问WSDL,然后VB6.0再去调用.NET。

      2.2 上一个问题还有一个可能性就是WSDL命名空间(暂且这么叫)的问题。

      例如:

      <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/xxx/xxx"
                  xmlns:impl="http://xxx/xxx/xxx/xxx"
                  targetNamespace="http://xxx/xxx/xxx/xxx"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

      比较关键的两个地方是xmlns:xsd="http://www.w3.org/2001/XMLSchema"和xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"对应着

      <wsdl:message name="xxx">
          <wsdl:part name="wsxlh" type="soapenc:string" />
          <wsdl:part name="xmlDoc" type="soapenc:string" />
      </wsdl:message>

      里面的type="soapenc:string"。现在这样的配置一般VB6.0不能正确的解析,如果要能正确额解析就要把xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 改为xmlns:soapenc="http://www.w3.org/2001/XMLSchema" ;或是把type="soapenc:string"改为type="xsd:string"。这样VB6.0就能正确的访问了。

      这方面的问题网上都只有提问,而没有回答的。这篇文章也是自己实践得来的结果,如有不正确的地方还望大家能够不吝赐教。

      PS:

      文章中引用了网上的文章,如果作者有异议我将马上去掉。