2009-07-02 101 views
0

我需要UR關於Web服務幫助傳統的ASP使用Web服務

這裏是我的代碼

Set oSOAP = Server.CreateObject("MSSOAP.SoapClient30") 
oSOAP.ClientProperty("ServerHTTPRequest") = True 
oSOAP.mssoapinit("http://buergerserviceschul.niedersachsen.de/modules/id/public/webservice/V4_00/rpc_lit/?wsdl") 
strXml = oSOAP.getAnliegenkategorien(session("id"),"",false,"INFODIENSTE","") 

,如果我通過的soapUI它prefectly運行,但在asp網頁執行它不會執行它不會給出數組和尺寸的錯誤。 現在我被困在這個,並不能進一步移動, 我已經嘗試過每一點。請建議我一些 感謝

回答

1

這是我們如何做到這一點:

SET oXmlHTTP = CreateObject("Microsoft.XMLHTTP") 
oXmlHTTP.Open "POST", "http://www.oursite.com/WebServices/ourService.asmx?WSDL", False 

oXmlHTTP.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8" 
oXmlHTTP.setRequestHeader "SOAPAction", "http://ourNameSpace/ourFunction" 
SOAPRequest = "<?xml version=""1.0"" encoding=""utf-8""?>" &_ 
       "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" &_ 
        "<soap12:Body>" &_ 
        "<ourFunction xmlns=""http://ourNameSpace/"">" &_ 
         "<var1>" & session("userid") & "</var1>" &_ 
         "<var2>" & Session("internetid") & "</var2>" &_ 
        "</ourFunction>" &_ 
        "</soap12:Body>" &_ 
       "</soap12:Envelope>" 

oXmlHTTP.send SOAPRequest 
+1

這是最好的避免這個問題用過的舊SOAP工具箱,並且使用XMLHTTP來代替,如@克里斯在做什麼。但是,我建議通過MSXML構建SOAP消息,而不要使用字符串連接。 MSXML知道XML是如何工作的,並且不會導致諸如「O'Brien」沒有被正確編碼的字符串問題。 – 2009-07-02 12:51:24