473,583 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

continuing the classic asp to web service saga: parse the response

16 New Member
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?

<title>Callin g a webservice from classic ASP</title>

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, "<", "&lt;"), ">", "&gt;") & "</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
End If


<form id="frmTest" name="frmTest"m ethod="post">
<table width="171" border="1">
<td width="161" align="right">< p>title:
<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>
<input name="firstname " type="text" id="firstname" maxlength="50">

<input name="surname" type="text" id="surname" maxlength="50">
<input name="email" type="text" id="email">
marital status:
<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>
<label> </label>
<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>months at address: </p>
<input name="monthsata ddress" type="text" id="monthsatadd ress">
house name or no:
<input name="housename no" type="text" id="housenameno ">
<input name="street" type="text" id="street">
<input name="town" type="text" id="town">
<input name="county" type="text" id="county">
<input name="postcode" type="text" id="postcode">
loan amount applying for:
<input name="loanamoun t" type="text" id="loanamount" >
<input name="loanterm" type="text" id="loanterm">
purpose for loan:
<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>
<input type="submit" value="Submit Application" name="cmdSubmit ">

Any help would be sorely appreciated. I will keep on it, and if I find an answer, will post it up.
Sep 8 '06 #1
2 3396
16 New Member
this is the returned xml from the web service. I need to write a portion of asp within the above script to do something IF the ResponseType is SUCCESS or FAILURE.

<BrokerID>14562 132</BrokerID>
<AppNo>1234-TST </AppNo>
<Trans>RESPONSE </Trans>
<ResponseType>S UCCESS</ResponseType>
<OurID>08/09/2006 04:22:47</OurID>

Thankyou for your time. Remember I am writing in classic asp.

Nice one guys :)
Sep 8 '06 #2
16 New Member
found out.

use the (inStr) command to find out where it lies and then perhaps the (Mid) command to write the if function.

Technical jargon is not my speciality so forgive me if i've used the wrong terminology.

You could either say

if the reply from the inStr is more than 0, then you could assume that the reply is saying SUCCESS. (Look at the returned XML above.)

Response.Write InStr(yourSoapR eplyString,"SUC CESS")

Or you could include the inStr value in the mid command to make sure the script starts reading the returned xml in the correct format.

If Mid(sQuerystrin g, InStr(sQueryStr ing,"SUCCESS"), 7) = "SUCCESS" Then

This will reply a value. You could use the response value to determine what happens next.
Sep 18 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not recognise datasets and requires a recordset. Can the datatypes be converted? At the Classic ASP end or .NET end? Can SOAP toolkit provide the...
by: ASPfool | last post by:
Hello everyone, Please help me before I throw my computer out of the window: I'm working on a web application in classic ASP (vbscript), which is making calls to some webservices. The calls are made using SOAP - i installed the SOAP3 toolkit on my windows 2k server to enable this. The webservice calls are returning String Arrays which I...
by: FS Liu | last post by:
Hi, I am writing ATL Service application (XML Web service) in VS.NET C++. Are there any sample programs that accept XML as input and XML as output in the web service? Thank you very much.
by: Julian Hershel | last post by:
Hi. I have a very simple web service that I am trying to call from a classic ASP page. The web service project and the ASP page are both on my development machine. That's the code of my web service: <WebService(Namespace:="http://tempuri.org/")> _ Public Class TextData Inherits System.Web.Services.WebService
by: Chumley Walrus | last post by:
I'm changing an old classic asp script over to asp.net; it displays links corresponding to each day of the week <script runat="server"> Sub Page_Load(s As Object, e As EventArgs) </script>
by: ryan.mclean | last post by:
Hi everyone! I'm hoping that someone can help me out. I have a webservice written in vb.net. This service uses the SoapHeader to secure the webservice to users that give a username and password. I am trying to call this webservice via classic asp. This works as long as the service is not authenticated. Here is the asp code: ...
by: Mark | last post by:
Hi all, I have a .NET webservice which I would like to consume from a classic ASP page. Furthermore, I would like to populate a recordset (if possible) with the data from the returned webservice so I can implement paging in the classic ASP page... Does anyone have any idea if I can do this, and if so, how I would go about implementing...
by: shadow.demon | last post by:
So ajax is the new black, i've had a couple ideas about how to implement it. I've alook at ajax.net and few other implementations but to me they're a bit complex. Maybe it's the way to go to have better coding. In the standard case of a dropdownlist, or listbox, that needs to be filled as the user types (aka google suggest), i thought it...
by: lambelly | last post by:
I can connect to a web service via asp.net, but my client is using asp classic. In asp.net I do something very simple along the lines of: CmsApi cmsService = new CmsApi(); Authenticate auth = new Authenticate(); auth.userName = userName.Text; auth.passWord = passWord.Text; AuthenticateResponse authrep = new AuthenticateResponse(); authrep =...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.