I need to update a few pages that send a forms based XML string to a site and display the returned values. I am not sure of the C# .NET 2.0 syntax to pull it off and wondered if anyone new of a good place to look. I have searched the web for the past few days and have not been able to come up with anything to help me out.

10 Years
Discussion Span
Last Post by SheSaidImaPregy

Does anyone have a clue on how to do this? Just to clarify further.... Values from a form will populate a XML string that is sent to DHL... Once they get the information they will also return rates to me.

Is this the right forum for this type of question or should I put it in the XML forum too?


Basically something like this, but with C# .Net

    counter = 1	
	Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
	xmlhttp.open "POST" ,"http://eCommerce.airborne.com/ApiLandingTest.asp",False
	xmlhttp.setRequestHeader "Content-Type", "text/xml"	
	'xmlhttp.open "POST" ,"https://www.zgraph.net",False
	xmltext ="<?xml version=""1.0"" encoding=""UTF-8""?>"&_
	"<eCommerce action=""Request"" version=""1.1"">"&_
	For x = 0 to 5
		xmltext = xmltext &_
		"<Shipment action=""RateEstimate"" version=""1.0"">"&_
				If datepart("m",cDater) < 10 Then
					xmltext = xmltext & "0"&datePart("m",cDater)
					xmltext = xmltext & datePart("m",cDater)
				End If
				xmltext = xmltext & "-"
				If datepart("d",cDater) < 10 Then
					xmltext = xmltext & "0"&datePart("d",cDater)
					xmltext = xmltext & datePart("d",cDater)
				End If
				xmltext = xmltext & "</ShipDate>"&_
				if cType = "P" and cInsureAmt > 5000 then
				    xmltext = xmltext & _
					"<Weight>"&cWeight&"</Weight>" & _
					"<ContentDesc>"&cShipDesc&"</ContentDesc>" & _
				elseif cType="P" then
				    xmltext = xmltext & _
					"<Weight>"&cWeight&"</Weight>" & _
				End If
				'Additional Protection
				If StripCommas(cInsureAmt) > 100 Then
				xmltext = xmltext & "<AdditionalProtection>"&_
				End if
				'End Additional Protection
				If trim(arrMethod(x,0,1)) <> "" Then
					xmltext = xmltext & _
					"<SpecialServices>" & _
						"<SpecialService>" & _
							"<Code>"&arrMethod(x,0,1)&"</Code>" & _
						"</SpecialService>" & _
				End If
			xmltext = xmltext & _
			"</ShipmentDetail>" & _
			    "<SentBy>" & "The Freight Rate Company" & "</SentBy>"&_
				    "<CompanyName>The Freight Rate Company</CompanyName>"&_
				    "<Street>123 Main Street</Street>"&_
				    "<City>" & "City" & "</City>"&_
				    "<CompanyName>The Freight Rate Company</CompanyName>"&_
				    "<Street>123 Main Street</Street>"&_
				    "<City>" & "City" & "</City>"&_
	Set x = nothing
	xmltext = xmltext & "</eCommerce>"

In a nutshell that code takes information from a bunch of textboxes and inserts that information in between the XML string.

Then the string is sent to DHL and they send back a response (another XML string) and I show the results on the page.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.