数据上传示例VB代码如下:
'''''''''''''''''''''''''''''''''''''''''''''''
WebServiceURL = "
http://127.0.0.1:9901/CertificateRequestService.asmx" '调用URL(URI)
WebMethodName = "
http://service.vidc.info/certificaterequest/UploadInsert_Ent" 'SOAP Action
'soap请求,需要根据具体WEB SERVICES web方法更改
sentRequest="<?xml version='1.0' encoding='utf-8'?>" _
& "<soap:Envelope xmlns

si='http://www.w3.org/2001/XMLSchema-instance' xmlns

sd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" _
& "<soap:Body>" _
& "<UploadInsert_Ent xmlns='http://service.vidc.info/certificaterequest'>" _
& "<data>" _
& "<CertificateInfo>" _
& "<WZHGZBH xmlns='http://www.vidc.info/certificate/operation/'>TEST99010091</WZHGZBH>" _
& "<CZRQ xmlns='http://www.vidc.info/certificate/operation/'>2001-12-01T12:00:00</CZRQ>" _
& "</CertificateInfo>" _
& "<CertificateInfo>" _
& "<WZHGZBH xmlns='http://www.vidc.info/certificate/operation/'>TEST99010092</WZHGZBH>" _
& "<CZRQ xmlns='http://www.vidc.info/certificate/operation/'>2001-12-01T12:00:00</CZRQ>" _
& "</CertificateInfo>" _
& "</data>" _
& "</UploadInsert_Ent>" _
& "</soap:Body>" _
& "</soap:Envelope>"
'''''''''''''''''''''''''''''''''''''''''''''''
Set requestHTTP = CreateObject("Microsoft.XMLHTTP")
requestHTTP.open "POST", WebServiceURL, false
requestHTTP.setrequestheader "Content-Type", "text/xml; charset=utf-8"
requestHTTP.setrequestheader "SOAPAction", WebMethodName
requestHTTP.Send sentRequest
MsgBox("请求已经送出. HTTP 请求处理状态= " & requestHTTP.status)
'服务反馈请求结果
MsgBox(requestHTTP.responsexml.xml)
'附加示例,处理反馈文档
ReturnCode=1
Result=""
Set objXml = CreateObject("MSXML2.DOMDocument")
If objXml.loadXML(requestHTTP.responseXML.xml) Then
ReturnCode=objXml.getElementsByTagName("ResultCode")(0).firstChild.data
For I=0 To (objXml.getElementsByTagName("NameValuePair").length-1)
Name=objXml.getElementsByTagName("NameValuePair")(I).childNodes(0).text
Value=objXml.getElementsByTagName("NameValuePair")(I).childNodes(1).text
Result=Result+vbCrLf+Name+":"+Value
Next
MsgBox("操作结果:"+ReturnCode+vbCrLf+"反馈结果:"+Result)
End If
只接收到Value属性表示合格证编号数据没能正确提交.具体错误请比对示例代码.附件为示例脚本.