I need to send xml data to a specified server and return the results. I have it covered in classic asp, but need to upgrade to .net 2.0 (C#). If anyone has a link to a tutorial or insight I would appreciate it.
This is what I have so far, but I cannot get it to work... - string postData = this.tbSend.Text;
-
string uriString = "http://website.com";
-
String strXML;
-
-
XMLHTTPClass xmlHTTP = new XMLHTTPClass();
-
-
xmlHTTP.open("POST", uriString, false, null, null);
-
xmlHTTP.send(postData);
-
-
while (xmlHTTP.readyState != 4)
-
{
-
}
-
-
strXML = (string)xmlHTTP.responseText;
-
this.tbGet.Text = strXML;
What namespace does xmlHTTPClass use? I have been checking the web for a while, but cannot come up with anything.
8 4254
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?
Use Remoting/WebService
Create the instance of that remote class in your code.
Using that proxy, call that method and pass your xml string.
:)
This might help to explain what I am trying to do a bit better. This is a portion that I did with Classic ASP. -
Sub RateWrite
-
counter = 1
-
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
-
'xmlhttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
-
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"">"&_
-
"<Requestor>"&_
-
"<ID>DHLID</ID>"&_
-
"<Password>DHLPass</Password>"&_
-
"</Requestor>"
-
For x = 0 to 5
-
xmltext = xmltext &_
-
"<Shipment action=""RateEstimate"" version=""1.0"">"&_
-
"<ShippingCredentials>"&_
-
"<ShippingKey>123456</ShippingKey>"&_
-
"<AccountNbr>123456</AccountNbr>"&_
-
"</ShippingCredentials>"&_
-
"<ShipmentDetail>"&_
-
"<ShipDate>"&datePart("yyyy",cDater)&"-"
-
If datepart("m",cDater) < 10 Then
-
xmltext = xmltext & "0"&datePart("m",cDater)
-
Else
-
xmltext = xmltext & datePart("m",cDater)
-
End If
-
xmltext = xmltext & "-"
-
If datepart("d",cDater) < 10 Then
-
xmltext = xmltext & "0"&datePart("d",cDater)
-
Else
-
xmltext = xmltext & datePart("d",cDater)
-
End If
-
xmltext = xmltext & "</ShipDate>"&_
-
"<Service>"&_
-
"<Code>"&arrMethod(x,0,0)&"</Code>"&_
-
"</Service>"&_
-
"<ShipmentType>"&_
-
"<Code>"&cType&"</Code>"&_
-
"</ShipmentType>"
-
if cType = "P" and cInsureAmt > 5000 then
-
xmltext = xmltext & _
-
"<Weight>"&cWeight&"</Weight>" & _
-
"<ContentDesc>"&cShipDesc&"</ContentDesc>" & _
-
"<Dimensions>"&_
-
"<Length>"&cLength&"</Length>"&_
-
"<Width>"&cWidth&"</Width>"&_
-
"<Height>"&cHeight&"</Height>"&_
-
"</Dimensions>"
-
elseif cType="P" then
-
xmltext = xmltext & _
-
"<Weight>"&cWeight&"</Weight>" & _
-
"<Dimensions>"&_
-
"<Length>"&cLength&"</Length>"&_
-
"<Width>"&cWidth&"</Width>"&_
-
"<Height>"&cHeight&"</Height>"&_
-
"</Dimensions>"
-
End If
-
'Additional Protection
-
If StripCommas(cInsureAmt) > 100 Then
-
xmltext = xmltext & "<AdditionalProtection>"&_
-
"<Code>"&"AP"&"</Code>"&_
-
"<Value>"&StripCommas(cInsureAmt)&"</Value>"&_
-
"</AdditionalProtection>"
-
End if
-
'End Additional Protection
-
If trim(arrMethod(x,0,1)) <> "" Then
-
xmltext = xmltext & _
-
"<SpecialServices>" & _
-
"<SpecialService>" & _
-
"<Code>"&arrMethod(x,0,1)&"</Code>" & _
-
"</SpecialService>" & _
-
"</SpecialServices>"
-
End If
-
xmltext = xmltext & _
-
"</ShipmentDetail>" & _
-
"<Billing>"&_
-
"<Party>"&_
-
"<Code>S</Code>"&_
-
"</Party>"&_
-
"</Billing>"&_
-
"<Sender>"&_
-
"<SentBy>" & "The Freight Rate Company" & "</SentBy>"&_
-
"<Address>"&_
-
"<CompanyName>The Freight Rate Company</CompanyName>"&_
-
"<Street>123 Main Street</Street>"&_
-
"<City>" & "City" & "</City>"&_
-
"<State>"&cStateFrom&"</State>"&_
-
"<Country>US</Country>"&_
-
"<PostalCode>"&cZipFrom&"</PostalCode>"&_
-
"</Address>"&_
-
"</Sender>"&_
-
"<Receiver>"&_
-
"<Address>"&_
-
"<CompanyName>The Freight Rate Company</CompanyName>"&_
-
"<Street>123 Main Street</Street>"&_
-
"<City>" & "City" & "</City>"&_
-
"<State>"&cStateTo&"</State>"&_
-
"<Country>US</Country>"&_
-
"<PostalCode>"&cZipTo&"</PostalCode>"&_
-
"</Address>"&_
-
"</Receiver>"&_
-
"<TransactionTrace>"&_
-
"<SpecialType>"&arrMethod(x,0,1)&"</SpecialType>"&_
-
"</TransactionTrace>"&_
-
"</Shipment>"
-
Next
-
Set x = nothing
-
xmltext = xmltext & "</eCommerce>"
-
Sorry buddy, I had misunderstood
Here is the code which will do that in .NET
http://codebetter.com/blogs/darrell.norton/archive/2003/07/17/468.aspx
Plater 7,872
Recognized Expert Expert
Yeah that's what I thought, the link I left was a conversion for it too.
Thanks guys... That was the info I needed. Not to say that I will not have more questions later, but for now I am at least able to keep on plugging. :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Fatih BOY |
last post by:
Hi,
I want to send a report from a windows application to a web page like
'report.asp'
Currently i can send it via post method with a context like
local=En&Username=fatih&UserId=45&Firm=none...
|
by: Kitchen Bin |
last post by:
Hi.
I am trying to use Sockets to do multiple Send and Receives via HTTP
(not simultaneously). A first pair of Send/Receives works fine and
sure enough I receive HTML back, but the next...
|
by: John J. Hughes II |
last post by:
I have a service that needs to send e-mail alerts. I have been attempting
to use the System.Net.Mail function from .NET but this seems to require the
IIS be installed and running. Since some of...
|
by: Aren Cambre |
last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's
BodyFormat = MailFormat.Html? I've searched all over the place and
cannot find a solution anywhere. I am running this on Windows XP...
|
by: Sven Huijbrechts |
last post by:
Hello,
I need to send a couple of "NUL"s -> HEX value "00" on a networkstream..
This is the code we currently use to send string:
Dim sendBytes As () =...
| |
by: Gerard |
last post by:
Hello
I have created a windows service to monitor a database, it starts some
checks when a timer elapses. The checks send emails depending on their
findings. My issue is that when I created a...
|
by: John Brock |
last post by:
I am currently using a VB.NET program to send out e-mails with
plain text bodies (plus one attachment). The emails are being
received as Rich Text messages (probably just my personal Outlook...
|
by: Sean |
last post by:
Hi... I want to use the macro/sendobject (or any other
procedure) to send the contents of a table (very small, ~5
rows/columns) as an Outlook message body, not as an
attachment. Access 2000 will...
|
by: keith.schincke |
last post by:
I know I must be missing something basic. I am developing of Firefox
1.5 and am trying to to send a basic QUERY_STRING to a test CGI that
will print the data back to the brower:
I can print my...
|
by: clevrmnkey |
last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I
finally need to make them work, and I can't for the life of me see what
I'm doing wrong.
I pared back my mail transaction to...
|
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,...
| |
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |