[转]直接使用XML做SOAP请求'保持属性值的局部变量
[转]直接使用XML做SOAP请求
Private mvarServerURL As String '局部复制
[转]直接使用XML做SOAP请求

[转]直接使用XML做SOAP请求
Public Property Let ServerURL(ByVal vData As String)
[转]直接使用XML做SOAP请求
'向属性指派值时使用,位于赋值语句的左边。
[转]直接使用XML做SOAP请求'
Syntax: X.ServerURL = 5
[转]直接使用XML做SOAP请求
    mvarServerURL = vData
[转]直接使用XML做SOAP请求
End Property
[转]直接使用XML做SOAP请求
[转]直接使用XML做SOAP请求
Public Property Get ServerURL() As String
[转]直接使用XML做SOAP请求
'检索属性值时使用,位于赋值语句的右边。
[转]直接使用XML做SOAP请求'
Syntax: Debug.Print X.ServerURL
[转]直接使用XML做SOAP请求
    ServerURL = mvarServerURL
[转]直接使用XML做SOAP请求
End Property
[转]直接使用XML做SOAP请求
[转]直接使用XML做SOAP请求
Public Function ExecuteCommandWithReturn(ByVal Command As StringAs String
[转]直接使用XML做SOAP请求    
Dim safeString As String    '身份验证码
[转]直接使用XML做SOAP请求
    Dim strXML As String        'SOAP查询
[转]直接使用XML做SOAP请求
    
[转]直接使用XML做SOAP请求    
'On Error GoTo Errs:
[转]直接使用XML做SOAP请求
    On Error Resume Next
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    safeString 
= LCase(Replace("592672-016767-2CC4F321-0E348AF1-AB52FF57-E07A""-"""))
[转]直接使用XML做SOAP请求
'    Command = Replace(Command, " ", " ")
[转]直接使用XML做SOAP请求'
    Command = Replace(Command, "'", "'")
[转]直接使用XML做SOAP请求'
    Command = Replace(Command, """", """)
[转]直接使用XML做SOAP请求'
    Command = Replace(Command, "<", "&lt;")
[转]直接使用XML做SOAP请求'
    Command = Replace(Command, ">", "&rt;")
[转]直接使用XML做SOAP请求'
    Command = Replace(Command, "&", "&amp;")
[转]直接使用XML做SOAP请求
   
[转]直接使用XML做SOAP请求    strXML 
= strXML & "<?xml version=""1.0"" encoding=""utf-8""?>" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "  <soap:Body>" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "    <ExecuteCommandWithReturn xmlns=""http://tempuri.org/GPSService/Data"">" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "      <SafeCode>" & safeString & "</SafeCode>" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "      <CommandText>" & Command & "</CommandText>" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "    </ExecuteCommandWithReturn>" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "  </soap:Body>" & vbCrLf
[转]直接使用XML做SOAP请求    strXML 
= strXML & "</soap:Envelope>"
[转]直接使用XML做SOAP请求        
[转]直接使用XML做SOAP请求    
'定义一个XML HTTP Request对象,用于发送请求
[转]直接使用XML做SOAP请求
    Dim soapHTTP As New MSXML.XMLHTTPRequest
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    
'定义一个XML的文档对象,将手写的或者接受的XML内容转换成XML对象
[转]直接使用XML做SOAP请求
    Dim soapXML As New MSXML.DOMDocument
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    
'将手写的SOAP字符串转换为XML对象
[转]直接使用XML做SOAP请求
    soapXML.loadXML strXML
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    
'向指定的URL发送Post消息
[转]直接使用XML做SOAP请求
    soapHTTP.open "POST", mvarServerURL & ""False
[转]直接使用XML做SOAP请求    soapHTTP.setRequestHeader 
"Content-Type""text/xml;charset=utf-8"
[转]直接使用XML做SOAP请求    
'soapHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2300)"
[转]直接使用XML做SOAP请求
    soapHTTP.setRequestHeader "SOAPAction""http://tempuri.org/GPSService/Data/ExecuteCommandWithReturn"
[转]直接使用XML做SOAP请求    soapHTTP.send (strXML)
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    
While soapHTTP.readyState <> 4  '等待处理完毕
[转]直接使用XML做SOAP请求
    Wend
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    
'返回的XML信息
[转]直接使用XML做SOAP请求
    Dim strReturn As String
[转]直接使用XML做SOAP请求    
'Debug.Print soapHTTP.responseText
[转]直接使用XML做SOAP请求
    Dim XMLReturn As MSXML.DOMDocument
[转]直接使用XML做SOAP请求    
Set XMLReturn = soapHTTP.responseXML
[转]直接使用XML做SOAP请求    
[转]直接使用XML做SOAP请求    ExecuteCommandWithReturn 
= XMLReturn.childNodes(1).Text
[转]直接使用XML做SOAP请求    
Set XMLReturn = Nothing
[转]直接使用XML做SOAP请求    
Set soapXML = Nothing
[转]直接使用XML做SOAP请求    
Set soapHTTP = Nothing
[转]直接使用XML做SOAP请求    
Exit Function
[转]直接使用XML做SOAP请求Errs:
[转]直接使用XML做SOAP请求    
MsgBox Err.Description
[转]直接使用XML做SOAP请求    Debug.Print Err.Description
[转]直接使用XML做SOAP请求
End Function

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-07-22
  • 2021-08-03
  • 2021-07-22
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2021-09-21
  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
相关资源
相似解决方案