I have now got this bulky piece of script working, it reads the form correctly, which sends the request to the web service using SOAP. It conforms to their DTD and the web service then responds and sends an xml document back to the page.
I would very much like the contents of the form to be entered into an sql database as it is sent to the web service, as their reply does not contain the full details filled into the form.
Aside from the response xml looking ugly written at the top of the html page, can anyone help me in my quest to open a success or failure page based upon the response xml recieved in the browser. i.e. can i parse it, picking out the SUCCESS or FAILURE text and use this info to forward to a new page?
<html>
<head>
<title>Callin g a webservice from classic ASP</title>
</head>
<body>
<%
If Not IsEmpty(Request .Form("cmdSubmi t")) Then
strAppData = ""
strAppData = strAppData & "<CentralTrust> "
strAppData = strAppData & " <Ident>" & vbcrlf
strAppData = strAppData & " <BrokerID>XXXXX XXX</BrokerID>" & vbcrlf
strAppData = strAppData & " <BrokerName>XXX XXXXXX</BrokerName>" & vbcrlf
strAppData = strAppData & " <AppNo>1234-TST</AppNo>" & vbcrlf
strAppData = strAppData & " <Trans>SHORTAPP SUBMIT</Trans>" & vbcrlf
strAppData = strAppData & " </Ident>" & vbcrlf
strAppData = strAppData & " <Application> " & vbcrlf
strAppData = strAppData & " <MainApp>" & vbcrlf
strAppData = strAppData & " <Title>" & Request.Form("t itle") & "</Title>" & vbcrlf
strAppData = strAppData & " <FirstName>" & Request.Form("f irstname") & "</FirstName>" & vbcrlf
strAppData = strAppData & " <Surname>" & Request.Form("s urname") & "</Surname>" & vbcrlf
strAppData = strAppData & " <Email>" & Request.Form("e mail") & "</Email>" & vbcrlf
strAppData = strAppData & " <Marital>" & Request.Form("m arital") & "</Marital>" & vbcrlf
strAppData = strAppData & " <HomePhone>" & Request.Form("h omephone") & "</HomePhone>" & vbcrlf
strAppData = strAppData & " <MobilePhone> " & Request.Form("m obilephone") & "</MobilePhone>" & vbcrlf
strAppData = strAppData & " <Address>" & vbcrlf
strAppData = strAppData & " <YearsAtAddress >" & Request.Form("y earsataddress") & "</YearsAtAddress> " & vbcrlf
strAppData = strAppData & " <MonthsAtAddres s>" & Request.Form("m onthsataddress" ) & "</MonthsAtAddress >" & vbcrlf
strAppData = strAppData & " <HouseNameNo> " & Request.Form("h ousenameno") & "</HouseNameNo>" & vbcrlf
strAppData = strAppData & " <Street>" & Request.Form("s treet") & "</Street>" & vbcrlf
strAppData = strAppData & " <Locality />" & vbcrlf
strAppData = strAppData & " <Town>" & Request.Form("t own") & "</Town>" & vbcrlf
strAppData = strAppData & " <County>" & Request.Form("c ounty") & "</County>" & vbcrlf
strAppData = strAppData & " <Postcode>" & Request.Form("p ostcode") & "</Postcode>" & vbcrlf
strAppData = strAppData & " </Address>" & vbcrlf
strAppData = strAppData & " </MainApp>" & vbcrlf
strAppData = strAppData & " <Details>" & vbcrlf
strAppData = strAppData & " <LoanAmount>" & Request.Form("l oanamount") & "</LoanAmount>" & vbcrlf
strAppData = strAppData & " <LoanTerm>" & Request.Form("l oanterm") & "</LoanTerm>" & vbcrlf
strAppData = strAppData & " <LoanPurpose> " & Request.Form("l oanpurpose") & "</LoanPurpose>" & vbcrlf
strAppData = strAppData & " </Details>" & vbcrlf
strAppData = strAppData & " </Application>" & vbcrlf
strAppData = strAppData & "</CentralTrust>" & vbcrlf
strSOAP = "<?xml version=""1.0"" encoding=""utf-8""?>" & vbcrlf
strSOAP = strSOAP & "<soap:Enve lope xmlns:soap=""ht tp://schemas.xmlsoap .org/soap/envelope/"" xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""htt p://www.w3.org/2001/XMLSchema"">" & vbcrlf
strSOAP = strSOAP & " <soap:Body>" & vbcrlf
strSOAP = strSOAP & " <SendApplicatio n xmlns=""http://www.centraltrus t.co.uk"">" & vbcrlf
strSOAP = strSOAP & " <appString>" & Replace(Replace (strAppData, "<", "<"), ">", ">") & "</appString>" & vbcrlf
strSOAP = strSOAP & " </SendApplication >" & vbcrlf
strSOAP = strSOAP & " </soap:Body>" & vbcrlf
strSOAP = strSOAP & "</soap:Envelope>" & vbcrlf
strURL = "http://testserver.mywe bservice.co.uk/WebService/awservice.asmx"
Set objHTTP = Server.CreateOb ject("Msxml2.Se rverXMLHTTP")
With objHTTP
.Open "POST", strUrl, false
.SetRequestHead er "Host", "testserver.myw ebservice.co.uk "
.SetRequestHead er "Content-Type", "text/xml; charset=utf-8"
.SetRequestHead er "SOAPAction ", "http://www.centraltrus t.co.uk/SendApplication "
.send strSOAP
Response.Write( .responseText)'this is the responded xml that I wish to use for redirection
End With
%>
<br>
<%
End If
%>
THIS IS THE FORM THAT NEEDS NOT ONLY TO GO TO THE ABOVE ASP TO BE INSERTED INTO THE XML FOR THE WEB SERVICE SOAP REQUEST, BUT ALSO NEEDS TO BE INPUTTED INTO A SQL DATABASE
<form id="frmTest" name="frmTest"m ethod="post">
<p>
<label></label>
</p>
<table width="171" border="1">
<tr>
<td width="161" align="right">< p>title:
<label>
<select name="title" id="title">
<option value="Mr" selected>mr</option>
<option value="Mrs">mrs </option>
<option value="Miss">mi ss</option>
<option value="Ms">ms</option>
<option value="Dr">dr</option>
</select>
</label>
</p>
<p>firstname:
<input name="firstname " type="text" id="firstname" maxlength="50">
surname:
<input name="surname" type="text" id="surname" maxlength="50">
email:
<input name="email" type="text" id="email">
marital status:
<label>
<select name="marital" id="marital">
<option value="S" selected>single </option>
<option value="M">marri ed</option>
<option value="D">divor ced</option>
<option value="C">co-habiting</option>
<option value="W">widow </option>
<option value="I">widow er</option>
</select>
</label>
<label> </label>
hometelno:
<input name="homephone " type="text" id="homephone" >
mobile tel. no:
<input name="mobilepho ne" type="text" id="mobilephone ">
years at address:
<input name="yearsatad dress" type="text" id="yearsataddr ess">
</p>
<p>months at address: </p>
<p>
<input name="monthsata ddress" type="text" id="monthsatadd ress">
</p>
<p>
house name or no:
<input name="housename no" type="text" id="housenameno ">
street:
<input name="street" type="text" id="street">
town:
<input name="town" type="text" id="town">
county:
<input name="county" type="text" id="county">
postcode:
<input name="postcode" type="text" id="postcode">
loan amount applying for:
<input name="loanamoun t" type="text" id="loanamount" >
loanterm:
<input name="loanterm" type="text" id="loanterm">
purpose for loan:
<label>
<select name="loanpurpo se" id="loanpurpose ">
<option value="CA" selected>Car</option>
<option value="DC">Debt Consolidation</option>
<option value="CD">Cons umer Durables</option>
<option value="HO">Holi day</option>
<option value="HI">Home Improvements</option>
<option value="OT">Othe r</option>
</select>
</label>
</p></td>
</tr>
</table>
<p>
<label></label>
<input type="submit" value="Submit Application" name="cmdSubmit ">
</p>
</form>
</body>
</html>
Any help would be sorely appreciated. I will keep on it, and if I find an answer, will post it up.