VB中呼叫WebService上的函式的方法
Dim XMLDOM As MSXML2.DOMDocument
Dim XMLDOMBack As MSXML2.DOMDocument
Dim soapClient As MSSOAPLib.soapClient
Dim xmlNodeList As MSXML2.IXMLDOMNodeList
Dim strSendXML As String
Dim strWSURL As String
Dim strWSDLURL As String
Dim ErrDesc As String
Dim strSuccessFlag As String
Set soapClient = New MSSOAPLib.soapClient
Set XMLDOM = New MSXML2.DOMDocument
Set XMLDOMBack = New MSXML2.DOMDocument
strWSURL = FlowERURL
strWSDLURL = strWSURL & "?WSDL"
''' create input xml stream for GetApproverLevelInfo
strSendXML = ""
strSendXML = strSendXML & ""
While Not rsCCCopies.EOF
strSendXML = strSendXML & "" & Trim$(rsCCCopies.Fields("usrname").Value) & " "
rsCCCopies.MoveNext
Wend
strSendXML = strSendXML & " "
XMLDOM.loadXML (strSendXML)
soapClient.mssoapinit strWSDLURL, "FlowERAPI", "FlowERAPISoap"
soapClient.ConnectorProperty("Timeout") = 1000000000
''' Call WebService Api GetEmployeeInfo
XMLDOMBack.loadXML (soapClient.GetApproverLevelInfo(XMLDOM.xml))
strSuccessFlag = Trim$(XMLDOMBack.selectSingleNode("FlowER/SuccessFlag").Text)
ErrDesc = Trim$(XMLDOMBack.selectSingleNode("FlowER/ReturnInfo").Text)
If LCase(strSuccessFlag) = "true" Then
''' success, get leader list of all user
Set xmlNodeList = XMLDOMBack.selectNodes("FlowER/ReturnInfo/ApproverList")
For intI = 1 To xmlNodeList.length
''' create input xml stream for GetEmployeeInfo
strSendXML = ""
strSendXML = strSendXML & ""
strSendXML = strSendXML & "" & Trim(xmlNodeList.nextNode.selectSingleNode("Approver/Emp_No").Text) & " "
strSendXML = strSendXML & " "
''' Call WebService Api GetEmployeeInfo
XMLDOM.loadXML (strSendXML)
XMLDOMBack.loadXML (soapClient.GetEmployeeInfo(XMLDOM.xml))
strSuccessFlag = Trim$(XMLDOMBack.selectSingleNode("FlowER/SuccessFlag").Text)
ErrDesc = Trim$(XMLDOMBack.selectSingleNode("FlowER/ReturnInfo").Text)
If LCase(strSuccessFlag) = "true" Then
strCCCopies = strCCCopies & Trim$(XMLDOMBack.selectSingleNode("FlowER/ReturnInfo/Mail_Account").Text) & ";"
Else
''' error
MsgBox "GetEmployeeInfo error!" & vbCrLf & "Error Desc: " & ErrDesc & " !", _
vbInformation, "Information Message :"
Exit Function
End If
Next intI
Else
''' error
MsgBox "GetApproverLevelInfo error!" & vbCrLf & "Error Desc: " & ErrDesc & " !", _
vbInformation, "Information Message :"
Exit Function
End If
''''release object area
Set XMLDOM = Nothing
Set soapClient = Nothing
Set XMLDOMBack = Nothing
Dim XMLDOMBack As MSXML2.DOMDocument
Dim soapClient As MSSOAPLib.soapClient
Dim xmlNodeList As MSXML2.IXMLDOMNodeList
Dim strSendXML As String
Dim strWSURL As String
Dim strWSDLURL As String
Dim ErrDesc As String
Dim strSuccessFlag As String
Set soapClient = New MSSOAPLib.soapClient
Set XMLDOM = New MSXML2.DOMDocument
Set XMLDOMBack = New MSXML2.DOMDocument
strWSURL = FlowERURL
strWSDLURL = strWSURL & "?WSDL"
''' create input xml stream for GetApproverLevelInfo
strSendXML = ""
strSendXML = strSendXML & "
While Not rsCCCopies.EOF
strSendXML = strSendXML & "
rsCCCopies.MoveNext
Wend
strSendXML = strSendXML & "
XMLDOM.loadXML (strSendXML)
soapClient.mssoapinit strWSDLURL, "FlowERAPI", "FlowERAPISoap"
soapClient.ConnectorProperty("Timeout") = 1000000000
''' Call WebService Api GetEmployeeInfo
XMLDOMBack.loadXML (soapClient.GetApproverLevelInfo(XMLDOM.xml))
strSuccessFlag = Trim$(XMLDOMBack.selectSingleNode("FlowER/SuccessFlag").Text)
ErrDesc = Trim$(XMLDOMBack.selectSingleNode("FlowER/ReturnInfo").Text)
If LCase(strSuccessFlag) = "true" Then
''' success, get leader list of all user
Set xmlNodeList = XMLDOMBack.selectNodes("FlowER/ReturnInfo/ApproverList")
For intI = 1 To xmlNodeList.length
''' create input xml stream for GetEmployeeInfo
strSendXML = ""
strSendXML = strSendXML & "
strSendXML = strSendXML & "
strSendXML = strSendXML & "
''' Call WebService Api GetEmployeeInfo
XMLDOM.loadXML (strSendXML)
XMLDOMBack.loadXML (soapClient.GetEmployeeInfo(XMLDOM.xml))
strSuccessFlag = Trim$(XMLDOMBack.selectSingleNode("FlowER/SuccessFlag").Text)
ErrDesc = Trim$(XMLDOMBack.selectSingleNode("FlowER/ReturnInfo").Text)
If LCase(strSuccessFlag) = "true" Then
strCCCopies = strCCCopies & Trim$(XMLDOMBack.selectSingleNode("FlowER/ReturnInfo/Mail_Account").Text) & ";"
Else
''' error
MsgBox "GetEmployeeInfo error!" & vbCrLf & "Error Desc: " & ErrDesc & " !", _
vbInformation, "Information Message :"
Exit Function
End If
Next intI
Else
''' error
MsgBox "GetApproverLevelInfo error!" & vbCrLf & "Error Desc: " & ErrDesc & " !", _
vbInformation, "Information Message :"
Exit Function
End If
''''release object area
Set XMLDOM = Nothing
Set soapClient = Nothing
Set XMLDOMBack = Nothing
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11411056/viewspace-733852/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- VB動態呼叫外部函式的方法 (轉)函式
- php呼叫webservice的幾種方法PHPWeb
- JS中函式內套函式的呼叫JS函式
- js 呼叫 WebService 方法JSWeb
- 避免SQL中的函式呼叫SQL函式
- 淺談API函式呼叫的方法API函式
- webservice中呼叫structWebStruct
- C++中函式呼叫的用法C++函式
- [譯] 解析 Go 中的函式呼叫Go函式
- vb呼叫儲存過程的方法儲存過程
- 走近VB.Net(二) 再談函式呼叫 (轉)函式
- JS函式的定義與呼叫方法JS函式
- php中呼叫類的屬性和函式的方法->_=>_::_$this->區別PHP函式
- 透過使用型別庫提高VB呼叫DLL函式的效能 (轉)型別函式
- 如何使用函式指標呼叫類中的函式和普通函式函式指標
- jquery原始碼;是怎麼實現直接呼叫$()函式原型上的方法的?jQuery原始碼函式原型
- JavaScript 中匿名函式的遞迴呼叫JavaScript函式遞迴
- 函式呼叫中堆疊的個人理解函式
- 外部函式的呼叫函式
- vb.net 類庫中如何使用webserviceWeb
- C中呼叫Lua函式函式
- 利用VB的函式快速破解VB程式! (2千字)函式
- 一種WebService的呼叫方式Web
- Javascript的函式呼叫與thisJavaScript函式
- js中的寫出想jquery中的函式一樣呼叫JSjQuery函式
- 你不知道的JavaScript--Item8 函式,方法,建構函式呼叫JavaScript函式
- VB呼叫API函式使視窗保持在最上層 (轉)API函式
- Matlab中@與函式呼叫Matlab函式
- 利用動態建立自動化介面實現VB的函式指標呼叫 (轉)函式指標
- [Java 基礎]--呼叫webservice介面的方法JavaWeb
- SQL中呼叫包含dbms_lock.sleep的函式SQL函式
- js函式 函式自呼叫 返回函式的函式 (閉包)JS函式
- vb如何使用ftp函式,vb如何使用ftp函式要知道這些FTP函式
- Lua中呼叫ref和out修飾引數的函式/過載函式函式
- webservice介面呼叫Web
- 函式呼叫棧的問題函式
- 虛擬函式的呼叫原理函式
- 避免對mod函式的呼叫函式