Hello one and all.
I have recently been working outside of my field of expertise alot, and it is greatly distressing me. I have learned a small amount of php and actionscript, but now need to move into the realm of asp.
I have been supplied this script in asp classic by the web service administrator as an example, but i have no idea how to use it in conjunction with a html POST form.
1. Should the form be put within the same page?
2. How do i replace the values in the strAppData portion of the script with the POST ones entered into the fields of the form?
The asp is working as expected, it's just that it's not dynamic.
<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>11111 111</BrokerID>" & vbcrlf
strAppData = strAppData & " <BrokerName>Tes ter Broker</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>Mr</Title>" & vbcrlf
strAppData = strAppData & " <FirstName>Jame s</FirstName>" & vbcrlf
strAppData = strAppData & " <Surname>Bond </Surname>" & vbcrlf
strAppData = strAppData & " <Email>james@un i-exports.co.uk</Email>" & vbcrlf
strAppData = strAppData & " <Marital>S</Marital>" & vbcrlf
strAppData = strAppData & " <HomePhone>0192 3280000</HomePhone>" & vbcrlf
strAppData = strAppData & " <MobilePhone>07 779876554</MobilePhone>" & vbcrlf
strAppData = strAppData & " <Address>" & vbcrlf
strAppData = strAppData & " <YearsAtAddress >0</YearsAtAddress> " & vbcrlf
strAppData = strAppData & " <MonthsAtAddres s>0</MonthsAtAddress >" & vbcrlf
strAppData = strAppData & " <HouseNameNo>38 </HouseNameNo>" & vbcrlf
strAppData = strAppData & " <Street>West Close</Street>" & vbcrlf
strAppData = strAppData & " <Locality />" & vbcrlf
strAppData = strAppData & " <Town>London</Town>" & vbcrlf
strAppData = strAppData & " <County>Great er London</County>" & vbcrlf
strAppData = strAppData & " <Postcode>HA3 5LR</Postcode>" & vbcrlf
strAppData = strAppData & " </Address>" & vbcrlf
strAppData = strAppData & " </MainApp>" & vbcrlf
strAppData = strAppData & " <Details>" & vbcrlf
strAppData = strAppData & " <LoanAmount>250 00</LoanAmount>" & vbcrlf
strAppData = strAppData & " <LoanTerm>120 </LoanTerm>" & vbcrlf
strAppData = strAppData & " <LoanPurpose>CA </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.cent raltrust.co.uk/AWDWebService/awdservice.asmx "
Set objHTTP = Server.CreateOb ject("Msxml2.Se rverXMLHTTP")
With objHTTP
.Open "POST", strUrl, false
.SetRequestHead er "Host", "testserver.cen traltrust.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)
End With
%>
<br>
<%
End If
%>
<form id="frmTest" name="frmTest"m ethod="post">
<input type="submit" value="Test" name="cmdSubmit ">
</form>
</body>
</html>
If anybody can spare any time at all, i'd really appreciate it.
Thanks again.
I have recently been working outside of my field of expertise alot, and it is greatly distressing me. I have learned a small amount of php and actionscript, but now need to move into the realm of asp.
I have been supplied this script in asp classic by the web service administrator as an example, but i have no idea how to use it in conjunction with a html POST form.
1. Should the form be put within the same page?
2. How do i replace the values in the strAppData portion of the script with the POST ones entered into the fields of the form?
The asp is working as expected, it's just that it's not dynamic.
<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>11111 111</BrokerID>" & vbcrlf
strAppData = strAppData & " <BrokerName>Tes ter Broker</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>Mr</Title>" & vbcrlf
strAppData = strAppData & " <FirstName>Jame s</FirstName>" & vbcrlf
strAppData = strAppData & " <Surname>Bond </Surname>" & vbcrlf
strAppData = strAppData & " <Email>james@un i-exports.co.uk</Email>" & vbcrlf
strAppData = strAppData & " <Marital>S</Marital>" & vbcrlf
strAppData = strAppData & " <HomePhone>0192 3280000</HomePhone>" & vbcrlf
strAppData = strAppData & " <MobilePhone>07 779876554</MobilePhone>" & vbcrlf
strAppData = strAppData & " <Address>" & vbcrlf
strAppData = strAppData & " <YearsAtAddress >0</YearsAtAddress> " & vbcrlf
strAppData = strAppData & " <MonthsAtAddres s>0</MonthsAtAddress >" & vbcrlf
strAppData = strAppData & " <HouseNameNo>38 </HouseNameNo>" & vbcrlf
strAppData = strAppData & " <Street>West Close</Street>" & vbcrlf
strAppData = strAppData & " <Locality />" & vbcrlf
strAppData = strAppData & " <Town>London</Town>" & vbcrlf
strAppData = strAppData & " <County>Great er London</County>" & vbcrlf
strAppData = strAppData & " <Postcode>HA3 5LR</Postcode>" & vbcrlf
strAppData = strAppData & " </Address>" & vbcrlf
strAppData = strAppData & " </MainApp>" & vbcrlf
strAppData = strAppData & " <Details>" & vbcrlf
strAppData = strAppData & " <LoanAmount>250 00</LoanAmount>" & vbcrlf
strAppData = strAppData & " <LoanTerm>120 </LoanTerm>" & vbcrlf
strAppData = strAppData & " <LoanPurpose>CA </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.cent raltrust.co.uk/AWDWebService/awdservice.asmx "
Set objHTTP = Server.CreateOb ject("Msxml2.Se rverXMLHTTP")
With objHTTP
.Open "POST", strUrl, false
.SetRequestHead er "Host", "testserver.cen traltrust.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)
End With
%>
<br>
<%
End If
%>
<form id="frmTest" name="frmTest"m ethod="post">
<input type="submit" value="Test" name="cmdSubmit ">
</form>
</body>
</html>
If anybody can spare any time at all, i'd really appreciate it.
Thanks again.
Comment