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 4261
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
But the problem occures when i want to send a data with & sign (i.e:
Firm=F&B). I try to solve this problem with using boundary, but i failed.
Any idea!?
|
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 Send/Receive pair (even
if identically the same as the first pair) returns no data.
eg. The following simplified code will receive some bytes:
s.Send(ByteGet, ByteGet.Length, SocketFlags.None);
bytes = s.Receive(RecvBytes, RecvBytes.Length, 0); //...
|
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 my customers are not really
happy with having the IIS installed, not being used except to send e-mail
this is becoming a problem.
I have also tried using a little program from code project for sending
e-mail which works great on older servers...
|
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 SP2,
and IIS's SMTP and WWW servers are installed.
Here is the error trace:
System.Web.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an...
|
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 () = Encoding.ASCII.GetBytes(inputtext.ToString)
networkStream.Write(sendBytes, 0, sendBytes.Length)
Since there is no char value for hex 00 (NUL) it's not possible to use a
| |
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 windows application it
worked fine, however I need to use a service as I don't want to rely
on a user being logged in. The errors I get are:
Index #:System.Web.HttpException: Could not access 'CDO.Message'
object. --->...
|
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
default, because I didn't do this in the program), but there is no
actual formatting (italics, color, etc.) in the message body, which
is passed to from VB.NET to Outlook as an unformatted text String.
I want to start applying formatting to the...
|
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 not allow "Send To Mail
Recipient" (as opposed to "send as attachment") for
tables. Needless to say, every other MS application
(Word, Excel, etc) let's me send anything I want as a
message body. Outlook lets me import anything as a
message...
|
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 query string with an alert() right before the
request.send(queryString). An examination of the cgi enviroment and
tcpdump does not show QUERY_STRING being set.
Is there some I uncrossed or T on dotted?
|
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 the bare minimum:
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("<my
mail server IP>", 25);
smtp.Send("<one of my email addresses>", "<another of my email
addresses>", "Hello", "World");
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |