ITPub博客

首页 > Linux操作系统 > Linux操作系统 > VB中调用WebService上的函数的方法

VB中调用WebService上的函数的方法

原创 Linux操作系统 作者:ljm0211 时间:2012-06-26 16:11:18 0 删除 编辑
    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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11411056/viewspace-733852/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-05-14

  • 博文量
    272
  • 访问量
    437222