Link to home
Start Free TrialLog in
Avatar of Neil Thompson
Neil ThompsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

receive XML request and return it using classic ASP

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
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Neil Thompson

ASKER

superb, thank you works perfectly :)