views:

113

answers:

1

hey guys,

i need ur help regarding web services in classic asp

here is my code

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","")

it wont execute if i execute through the soapUI it prefectly runs but in asp page it wont gives error of array and dimensions. now i am stuck at this and could not move further, i have tried every bit. please suggest me something thanks

+1  A: 

This is how we do it:

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""&gt;" &_
         "<soap12:Body>" &_
        "<ourFunction xmlns=""http://ourNameSpace/""&gt;" &_
          "<var1>" & session("userid") & "</var1>" &_
          "<var2>" & Session("internetid") & "</var2>" &_
        "</ourFunction>" &_
         "</soap12:Body>" &_
       "</soap12:Envelope>"

oXmlHTTP.send SOAPRequest
Chris Klepeis
It's best to avoid the old SOAP Toolbox used in the question, and to use XMLHTTP instead, as @Chris is doing. However, I'd recommend building your SOAP message through MSXML and not using string concatenation. MSXML knows how XML is meant to work, and won't cause problems with strings like "O'Brien" not being properly encoded.
John Saunders
Thanks John, I'll take a second look at it :)
Chris Klepeis
one more question"i dont know whether it is asmx file or not"second in login attempt i am able to do that with the above code but when i try some other function as i mentioned in the post then it gives error of array index.
chsab420
it works for me if i use xml hardcoded or from string but i could not do with the specified URL (web service)
chsab420