全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
最近的项目中要用到web service,通过internet 发现vb就可以实现soap的客户端,要用到MSSOAPLib.SoapClient,MSSOAPLib.SoapSerializer.这些东东.实现代码如下(老外的)VERSION 5.00Begin VB.Form Form1 Caption = Form1 ClientHeight = 2475 ClientLeft = 60 ClientTop = 345 ClientWidth = 4575 LinkTopic = Form1 ScaleHeight = 2475 ScaleWidth = 4575 StartUpPosition = 3 Windows Default Begin VB.CommandButton Command1 Caption = Command1 Height = 615 Left = 960 TabIndex = 0 Top = 720 Width = 2295 EndEndAttribute VB_Name = Form1Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalsePublic sClient As New MSSOAPLib.SoapClientPrivate Const c_WSDL_URL As String = _ http:/cst48/espresentation/webservices/systemstatus.asmx?WSDLYou need soap Type library 3.0 and microsoft xml v2.6to run this examplePrivate Sub Command1_Click()sClient.mssoapinit c_WSL_URLDebug.Print Time TranslateBabelDebug.Print Time MsgBox finish End SubPublic Sub TranslateBabel() Purpose: Translates text from one language to another. WSDL: /vx_engine/wsdl_publish.vep/translate.wsdl More info: /detail.html?id=94 Dim objClient As MSSOAPLib.SoapClient To package SOAP request. Dim objSerial As MSSOAPLib.SoapSerializer To read SOAP response. Dim objRead As MSSOAPLib.SoapReader To connect to Web service using SOAP. Dim objConn As MSSOAPLib.SoapConnector To parse the SOAP response. Dim objResults As MSXML2.IXMLDOMNodeList Dim objNode As MSXML2.IXMLDOMNode Set up the SOAP connector. Set objConn = New MSSOAPLib.HttpConnector Define the endpoint URL. This is the actual running code, not the WSDL file path! You can find it in the WSDLs tags location attribute. objConn.Property(EndPointURL) = http:/cst48/espresentation/webservices/systemstatus.asmx Define the SOAP action. You can find it in the WSDLs tags soapAction attribute for the matching tag. GetNaturalInfo is the name of the service objConn.Property(SoapAction) = /GetNaturalInfo objConn.Property(SoapAction) = GetNaturalInfo Begin the SOAP message. objConn.BeginMessage Set objSerial = New MSSOAPLib.SoapSerializer Initialize the serializer to the connectors input stream. objSerial.Init objConn.InputStream Build the SOAP message. With objSerial .startEnvelope .startBody Use the Web methods name and schema target namespace URI. .startElement GetNaturalInfo .endElement .endBody .endEnvelope End With Send the SOAP message. objConn.EndMessage Set objRead = New MSSOAPLib.SoapReader Initialize the SOAP reader to the connectors output stream. objRead.Load objConn.OutputStream Set objResults = objRead.RPCResult.childNodes Iterate
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年黔西南州辅警协警招聘考试备考题库含答案详解(综合题)
- 2025年玉林辅警协警招聘考试备考题库含答案详解(达标题)
- 2025年阳江辅警协警招聘考试备考题库含答案详解(典型题)
- 2025年红河州辅警招聘考试题库及参考答案详解1套
- 2025年白山辅警招聘考试题库含答案详解(典型题)
- 2025年莆田辅警招聘考试真题附答案详解(a卷)
- 2025年莱芜辅警招聘考试真题及答案详解(考点梳理)
- 2025年西双版纳州辅警协警招聘考试真题参考答案详解
- 2025年铜梁县辅警协警招聘考试真题附答案详解ab卷
- 2025年长春辅警招聘考试真题含答案详解(模拟题)
- UL线材基础知识培训课件
- 常见精神疾病的识别和处理
- 2025年综合类-银行客户经理考试-中国银行客户经理考试历年真题摘选带答案(5卷100道合辑-单选题)
- 动机测量方法-洞察及研究
- 公司适用法律法规标准清单2025年08月更新
- 住院医师规范化培训个人总结
- 设计文件审核管理制度
- 一般固废仓库管理制度
- 千野草场旅游路线设计
- 2025年普通话水平测试试题
- 特药门诊用药管理制度
评论
0/150
提交评论