Solved

receive XML request and return it using classic ASP

Posted on 2014-02-03
2
1,535 Views
Last Modified: 2014-02-04
Hi

Bit of a weird question as I no nothing about ASP but need to alter a bit of code. At present I'm having issues as I cannot see the FULL XML code that is being sent to a page (as its part of a CRM system) so what I want to do is basically grab whatever XML request comes to this page, and return it.

By returning it I can then associate this with a field on the screen which it populates, then a basic right click "view source" should hopefully show me the entire XML

Sounds naff right, but its the only way itll work ;)

This is what I have so far, this returns a single value based on what is sent, how can I simply grab all that is sent and chuck it back?

Full code please as I'm a Java, PHP guy.

<%
	' - no cache -
	Response.Expires = -1000

	' - define variables -
	Dim XMLDoc
	Dim outXml
	Dim fridgeNo
	Dim cost
	Dim ffCost
	Dim totalCost
	Dim priceFridge = 10
			
	' - Load XML -	
	Set XMLDoc = CreateObject("Microsoft.XMLDOM")	
	XMLDoc.load(Request)
	
	' - Read XML and get fridgeNo count -
	Set myNode = XMLDoc.SelectSingleNode("//fridgeNo")
	if myNode.text = "" Then
		fridgeNo = cint(0)
	else
		fridgeNo = cint(myNode.text)
	end if           
			
	' - work out fidge cost -
    if fridgeNo=cdbl(0) Then
        cost = cdbl(cost) + cdbl(0)
        ffCost = cdbl(0)
    else
        cost = cdbl(cost) + (fridgeNo * priceFridge)
        ffCost = (fridgeNo * priceFridge)
    end if

	' - build the XML response -
	XMLDoc.SelectSingleNode("//txtFFCost").Text = FormatNumber(ffCost,2)
	XMLDoc.SelectSingleNode("//txtTotalCost").Text = FormatNumber(cost,2)
	XMLDoc.SelectSingleNode("//fridgeNo").Text = ""
	
	' - trap any errors -
	If XMLDoc.parseError.errorcode <> 0 Then
		Response.write("XML Parse Error Code = " & XMLDoc.parseError.errorcode)
		Response.end
	end if
	
	' - return the XML -
	Response.ContentType = "text/xml"
	Response.write(xmlDoc.xml)
	
	' - bye -
	Set XMLDoc = Nothing
%>

Open in new window


thanks
Neil
0
Comment
Question by:NeilT
2 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39829274
>so what I want to do is basically grab whatever XML request comes to this page, and return it.

Where you have

' - Load XML -	
	Set XMLDoc = CreateObject("Microsoft.XMLDOM")	
	XMLDoc.load(Request)

Open in new window

You should be able to write out that variable.

response.write (Request) ' print to screen
response.end()  ' don't bother with the rest of the code
<%
	' - no cache -
	Response.Expires = -1000

	' - define variables -
	Dim XMLDoc
	Dim outXml
	Dim fridgeNo
	Dim cost
	Dim ffCost
	Dim totalCost
	Dim priceFridge = 10
			
	' - Load XML -	
	Set XMLDoc = CreateObject("Microsoft.XMLDOM")	
	XMLDoc.load(Request)

' ******** new code here **************

response.write(Request)
response.end

' ******* end new code ****************
	
	' - Read XML and get fridgeNo count -
	Set myNode = XMLDoc.SelectSingleNode("//fridgeNo")
	if myNode.text = "" Then
		fridgeNo = cint(0)
	else
		fridgeNo = cint(myNode.text)
	end if           
			
	' - work out fidge cost -
    if fridgeNo=cdbl(0) Then
        cost = cdbl(cost) + cdbl(0)
        ffCost = cdbl(0)
    else
        cost = cdbl(cost) + (fridgeNo * priceFridge)
        ffCost = (fridgeNo * priceFridge)
    end if

	' - build the XML response -
	XMLDoc.SelectSingleNode("//txtFFCost").Text = FormatNumber(ffCost,2)
	XMLDoc.SelectSingleNode("//txtTotalCost").Text = FormatNumber(cost,2)
	XMLDoc.SelectSingleNode("//fridgeNo").Text = ""
	
	' - trap any errors -
	If XMLDoc.parseError.errorcode <> 0 Then
		Response.write("XML Parse Error Code = " & XMLDoc.parseError.errorcode)
		Response.end
	end if
	
	' - return the XML -
	Response.ContentType = "text/xml"
	Response.write(xmlDoc.xml)
	
	' - bye -
	Set XMLDoc = Nothing
%>

Open in new window

The above is just for testing so you can see the entire response.
0
 
LVL 3

Author Closing Comment

by:NeilT
ID: 39834861
superb, thank you works perfectly :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now