例如:如果在VBS中发送请求的代码如下,如何用C#实现?Dim objXMLHTTP Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")objXMLHTTP.Open "POST", "http://url/test.asmx", False
objXMLHTTP.setRequestHeader "Content-Type","text/xml"
objXMLHTTP.setRequestHeader "SOAPAction","http://url/GetRequest"Dim szData
szData = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<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/"">" & _
"<soap:Body><Test>tt</Test>" & _
"</soap:Body>" & _
"</soap:Envelope>"objXMLHTTP.setRequestHeader "Content-Length", Len(szData)
objXMLHTTP.Send szDataDim strResponse
strResponse=objXMLHTTP.ResponseText
msgbox strResponse
objXMLHTTP.setRequestHeader "Content-Type","text/xml"
objXMLHTTP.setRequestHeader "SOAPAction","http://url/GetRequest"Dim szData
szData = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<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/"">" & _
"<soap:Body><Test>tt</Test>" & _
"</soap:Body>" & _
"</soap:Envelope>"objXMLHTTP.setRequestHeader "Content-Length", Len(szData)
objXMLHTTP.Send szDataDim strResponse
strResponse=objXMLHTTP.ResponseText
msgbox strResponse
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货