473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

hi please help me soooooooooon reading xml file

hi i have this code it has error that "stream was not readable" im new in xml do you have any idea?i have to pass data to site and get the reason in xm
regards ... mahs

// Put user code to initialize the page her
//Declare variable
string bolRequest ; // a string to hold XML bolRequest document,,a string to hold XML Bill of Lading Request documen
//stringBuffer bolResponse = new StringBuffer(50000)

string bolResponse; //an XML DOM object to hold the BOL Response documen
string localError ; // a string to store any Error Messages
string status = ""; //sample variable to demonstrate how to pull values out of XML element
string conwayXMLURL = "http://www.con-way.com/XMLj/X-BOL"
string bolRequestFormName = "BOLrequest"

// Con-Way authenticatio
// *** replace the "userId" & "passWd" String values with your Con-Way username and passwor
string userId = "uid";//for authentication to Con-Way secure sit
string passWd = "pass";//for authentication to Con-Way secure sit
DateTime today =new DateTime();//String to hold today's dat

bolRequest="<BOLrequest testmode=\"Y\">"
"<RequesterUserId shipcode=\"S\">" + userId + "</RequesterUserId>"
"<ChargeCode>P</ChargeCode>"
"<PRONmbr></PRONmbr>"
"<CustRefNmbrs>"
"<PurchaseOrderNmbr>3338889</PurchaseOrderNmbr>"
"<PurchaseOrderNmbr>3338890</PurchaseOrderNmbr>"
"<OtherRefNmbr refcode=\"SKU\" refdesc=\"SKU Number\">3213A</OtherRefNmbr>"
"<OtherRefNmbr refcode=\"UPC\" refdesc=\"UPC number\">789283</OtherRefNmbr>"
"</CustRefNmbrs>"
"<Shipper>"
"<ShipperName>Alan Shipley</ShipperName>"
"<ShipperAddr>1234 NE Main</ShipperAddr>"
"<ShipperCity>Portland</ShipperCity>"
"<ShipperState>OR</ShipperState>"
"<ShipperZip country=\"US\">97202</ShipperZip>"
"<ShipperPhone extension=\"6055\">503.450.6055</ShipperPhone>"
"<ShipperEmail>vo***************@con-way.com</ShipperEmail>"
"</Shipper>"
"<COD>"
"<CODremitTo>"
"<CODremitToName>Albert Cod</CODremitToName>"
"<CODremitToAddr>1234 NE Main</CODremitToAddr>"
"<CODremitToCity>Portland</CODremitToCity>"
"<CODremitToState>OR</CODremitToState>"
"<CODremitToZip country=\"US\">97202</CODremitToZip>"
"</CODremitTo>"
"<CODamount pmttype=\"CustomerCheck\" chargecode=\"P\">4444.44</CODamount>"
"</COD>"
"<Consignee>"
"<ConsigneeCustNmbr>883885</ConsigneeCustNmbr>"
"<ConsigneePhone extension=\"6666\">503.450.6800</ConsigneePhone>"
"<ConsigneeEmail>vo***************@con-way.com</ConsigneeEmail>"
"</Consignee>"
"<Item>"
"<Quantity pkgtype=\"PLT\">44</Quantity>" +
"<Weight unit=\"lbs\">667</Weight>"
"<Description>widget-arms</Description>"
"<CmdtyClass>775</CmdtyClass>"
"<NMFClass></NMFClass>"
"<HazMat>N</HazMat>"
"</Item>"
"<Item>"
"<Quantity pkgtype=\"PCS\">11</Quantity>" +
"<Weight unit=\"lbs\">789</Weight>"
"<Description>cam-shafts</Description>"
"<CmdtyClass>100</CmdtyClass>"
"<NMFClass></NMFClass>"
"<HazMat>N</HazMat>"
"</Item>"
"<Accessorial chargecode=\"P\">GUR</Accessorial>"
"<Accessorial chargecode=\"C\">DID</Accessorial>"
"<Accessorial chargecode=\"C\">DST</Accessorial>"
"<ShippingRemarks>TEST TEST TEST</ShippingRemarks>"
"<EmergencyContact></EmergencyContact>"
"<PickupRequest>"
"<PickupDate>" + today + "</PickupDate>"
"<PickupReadyTime>4:00 pm</PickupReadyTime>"
"<DockCloseTime>7:00 pm</DockCloseTime>"
"<ContactName>Frank</ContactName>"
"<ContactCompany>Franklin Arms</ContactCompany>"
"<ContactPhone>(333)444-4321</ContactPhone>"
"</PickupRequest>"
"<SendBOLemail/>"
"</BOLrequest>"

bolRequest = Server.UrlEncode(bolRequest);// converts characters to proper format for pos
ASCIIEncoding encoding=new ASCIIEncoding()
string authString = userId + ":" + passWd

byte[] data = encoding.GetBytes(authString)

HttpWebRequest myConnection = (HttpWebRequest)WebRequest.Create(conwayXMLURL);
// Setup connection parameters
myConnection.Method = "POST";
myConnection.ContentType="application/x-www-form-urlencoded";
myConnection.ContentLength = data.Length;
myConnection.Timeout = -1;

Stream newStream=myConnection.GetRequestStream();

// Send the data.
newStream.Write(data,0,data.Length);
newStream.Flush();
newStream.Close();

Stream iStream=myConnection.GetRequestStream();

StreamReader myInReader=new StreamReader(iStream);

//int chr = myInReader.Read();
//int responseLength = 0;
// Build the response Stringbuffer from the InputStream
//while (chr != -1)
//{
//responseLength++;
//bolResponse.append(String.valueOf((char) chr));
//chr = myInReader.read();
//}
Nov 18 '05 #1
0 863

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

Similar topics

13
by: yy0127 | last post by:
I don't know why i entered the below code and it will miss some records. Anyone can help me??? users = {} users1 = {} while 1: user, serviceType, msgType, inOut, date, time, numBytes =
7
by: Shane | last post by:
Hi, Thanks in advance for the help. I have been to many websites and tried several solutions to my problem, but have fixed part of it. It's time to come humbly to the newsgroups for help :-) ...
1
by: Esteban Felipe | last post by:
Hi, thanks for reading. I hope to find some help here before I commit suicide because this is driving me crazy. Please excuse me if this looks like a long post, but I hope that a complete...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
0
by: raa abdullah | last post by:
Overview A conflict-serializbility\recoverability checker, SCR, is a program that takes in a schedule and outputs 2 decisions: Conflict serialzable or Not confilict serializable AND Recoverable or...
4
by: baroon | last post by:
i need help please this program in c and ineed someone to change it in to c++ (change the format).please i need it as soon as u can before tuesday:) ...
22
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
4
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
jinu1996
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 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.