473,698 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a xml record

Hello. I got this message

<ns0:Orden xmlns:ns0="http ://localhost/CreditCheck">
<IdCliente>10 </IdCliente>
- <Pedido>
<IdProducto>IdP roducto_0</IdProducto>
<Cantidad>10. 4</Cantidad>
<PrecioUnitario >10.4</PrecioUnitario>
</Pedido>
<Estado>Estado_ 0</Estado>
</ns0:Orden>

And I am trying to create the message with this code. but I dont know how
to do the record.
private void btnEnviar_Click (object sender, System.EventArg s e)

{

string requestLocation = "http://localhost/HwsMessages/BTSHTTPReceive. dll";

Status.Text = "";

XmlDocument xmlDocument = new XmlDocument();

xmlDocument.Pre serveWhitespace = true;

XmlNode tempXmlNode = xmlDocument.Cre ateNode(XmlNode Type.Element, "Orden",
"http://localhost");

xmlDocument.App endChild(tempXm lNode);
tempXmlNode = xmlDocument.Cre ateNode(XmlNode Type.Element, "IdCliente" , "");

tempXmlNode.Inn erText = txtidcliente.Te xt;

xmlDocument.Doc umentElement.Ap pendChild(tempX mlNode);

tempXmlNode = xmlDocument.Cre ateNode(XmlNode Type.Element, "Timestamp" , "");

DateTime now = DateTime.Now;

tempXmlNode.Inn erText = now.ToString("s ");

xmlDocument.Doc umentElement.Ap pendChild(tempX mlNode);

tempXmlNode = xmlDocument.Cre ateNode(XmlNode Type.Element, "Notes", "");

tempXmlNode.Inn erText = Notes.Text;

xmlDocument.Doc umentElement.Ap pendChild(tempX mlNode);

try

{

HttpWebRequest request = (HttpWebRequest )
HttpWebRequest. Create(requestL ocation);

request.Method = "POST";

ASCIIEncoding encoding = new ASCIIEncoding() ;

byte[] requestData = encoding.GetByt es(xmlDocument. OuterXml);

request.Content Type="applicati on/x-www-form-urlencoded";

request.Content Length = xmlDocument.Out erXml.Length;

Status.Text += "Submitting activity message";

Stream requestStream = request.GetRequ estStream();

requestStream.W rite(requestDat a,0,requestData .Length);

requestStream.F lush();

requestStream.C lose();

HttpWebResponse response = (HttpWebRespons e) request.GetResp onse();

StreamReader responseData = new StreamReader( response.GetRes ponseStream());

Status.Text = System.Web.Http Utility.HtmlEnc ode( responseData.Re adToEnd()) +
"<br>";

}

catch (WebException wex)

{

Status.Text = "Unable to complete web request. Web Exception error: " +
wex.Message;

}

}

Thanks

Nov 19 '05 #1
0 1055

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9090
by: David Elliott | last post by:
I can create this: ?xml version="1.0" standalone="yes" ?> <ConfigOpt> <record> <Field_1>Text # 1</Field_1> <Field_2>Text # 2</Field_2> </record> </ConfigOpt>
0
1799
by: Jonathan Fisher | last post by:
What¹s the appropriate way to create records in related, subsidiary tables when a record is created in a main table? I¹m using Access 2000, and I have a main table called tblProject, and a few other tables in one-to-one relationships with it (on the field ProjectKey), called tblProjectAccounting, tblProjectSales, etc. (I separated them to get around the limit of 255 fields, and to make record-locking more flexible.) My first thought...
1
2539
by: Tom Cusick | last post by:
We have a Job Shop database. When I get an order in I put all the line item information into the database. Some orders have multiple lines and most of the information is the same. (eg. Customer Name, PO, Due Date, Received, etc.) 2 questions: 1. I have a button to create a new record on my switchboard, but what I would like that button to do is create a new record but enter in the next job number. Our job numbers are 'H1001', so I...
4
4050
by: amywolfie | last post by:
I've been trying to do something for about 3 days – I get close, but not 100%. I am trying to: Open frmRevisionHistory from a button on frmFeeInput. If there is NO RELATED RECORD, then I need to create one in frmRevisionHistory, and pass the PK (PK_Fees) on frmFeeInput to FK_Fees on the 2nd form.
0
3639
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
2
5477
by: mael.iosa | last post by:
Hi, I'm new to this group and fairly new to Access. I have a bunch of data, and after several other queries, I generate the following query which has two fields: Bin, Time 20 3.5 20 3.9 20 4.6 40 2.4 40 2.7
2
1300
by: Gasnic | last post by:
Hi I need to create a .NET object that will be serialized into the following xml structure ( I can't change the XML schema) <Root> <Record> <Field1>data1</Field1> <Field2>data2</Field2> <Record> <Record>
4
12437
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
4
4704
by: ringer | last post by:
I have a db where each record is a certain task to be done. Each record includes the date the task should be completed. Some of the tasks are one time only but some are recurring. I have been having to create a new record for every task even the recurring ones, but I'd like to try to automate creation of the recurring tasks. What I'm trying to do is set it up so that when I'm setting up a task I can select from a drop down box that this task...
12
3277
by: tekctrl | last post by:
Environment; Win2K PC with 1Gb of RAM and plenty of HD space running Access 2002 Issue; Access presents a blank data entry form in the Forms view when the New Record icon is used. However, it won't allow any fields to have data entered into them. I can edit & save existing records without problem. When I go into the Tables view, I can add records and data ok and save without problem. I go back into the Table and I can see the data. ...
0
8600
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,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8860
tracyyun
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...
0
7712
agi2029
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...
1
6518
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
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();...
0
4361
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...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.