Classic ASP consuming iMIS membership webservice.

 

Posted September 30th, 2009 by BWALKER

<%
Dim objHTTP, strEnvelope
Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
Dim username_str, password_str
username_str = "querystring"
password_str = "querystringPassword"
'Create the SOAP Envelope.
'Start with standard xml name space and XML Schema Definition.
strEnvelope = "<?xml version='1.0' encoding='utf-8'?>"
strEnvelope = strEnvelope & "<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/'>"
'Define body of SOAP with method name and parameter names and vlaues to be passed.
strEnvelope = strEnvelope & "<soap:Body>"
strEnvelope = strEnvelope & "<LoginUser xmlns='http://imis.com/webservices/membership'>"
strEnvelope = strEnvelope & " <username>" & username_str & "</username>"
strEnvelope = strEnvelope & "<password>" & password_str & "</password>"
strEnvelope = strEnvelope & "<staffUser>false</staffUser>"
strEnvelope = strEnvelope & "</LoginUser>"
strEnvelope = strEnvelope & "</soap:Body></soap:Envelope>"
   
'Set properties of HTTP object and send SOAP envelop while calling  method
Dim url
url = "http://webconfigURLKey/iMIS15/AsiCommon/Services/Membership/MembershipWebService.asmx?op=LoginUser"
With objHTTP   
    .Open "post", url, False   
    .setRequestHeader "Content-Type", "text/xml; charset=utf-8"   
    .setRequestHeader "SOAPAction", "http://imis.com/webservices/membership/LoginUser"   
    .send strEnvelope
End With
 
' Following will write xml received from web services in the browser
 
Dim strResponse
strResponse = objHTTP.responseXML.Text
 
If (strResponse = "") Then   
    Response.Write("Invalid user")
Else           
 
Set myXmlDoc = Server.CreateObject("MSXML2.DOMDocument")   
myXmlDoc.loadXML (strResponse) 
 
 
 
 

 

Response.Write(strResponse)     

 End If

 
 
 
%>