Reddy Anoop

Greenhorn
+ Follow
since Aug 22, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Reddy Anoop

I am using POST. Here is the code that I have. The servlet accepts a varible called "data" that has the complete xml. Please suggest.
Regards



String str = "";
String line = "";
String data1 = "";
// Send data
URL url = new URL(" http://xx123.test:80/translate");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr =
new OutputStreamWriter(conn.getOutputStream());
BufferedReader br =
new BufferedReader(new InputStreamReader(blb.getBinaryStream()));

while ( (str = br.readLine())!=null)
{
data1 += str; //strBuffer.append(str); }
line = URLEncoder.encode("data", "UTF-8") + "=" +
URLEncoder.encode(data1, "UTF-8");
System.out.println(line);

wr.write(line);
wr.flush();

// Get the response
BufferedReader rd =
new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result.append(line);
}
wr.close() ;
rd.close();
}
catch (Exception e) {
e.printStackTrace(); // should do real exception handling
}
Hi!

I am calling a servlet by passing XML data.

Sample xml that I am passing:


data1 =
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TestServlet SYSTEM "http://www.123.com:80/dtds/200703v1.dtd">
<TestConfig generatedDate="31 Oct 2007 16:27:30 GMT" dtdVersion="200703v1" qualification="false">
<MemoryModule mfgPartNum="501-6242" displaySequence="1000"/>
</TestConfig>

String line = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(data1, "UTF-8");

when I print the variable line, it prints ASCII values.
data=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%3C%21DOCTYPE+Configuration+SYSTEM+
%22http%3A%2F%2Fwww.123.com%3A80%2Fdtds

I wanted to send the xml as it is, can anyone please advise how to do this.

Regards
Anoop

[ UD: added linebreak ]
[ November 14, 2007: Message edited by: Ulf Dittmer ]
Hi! I need to call a servlet via http_post with a data parameter. The parameter has the data that the servlet will process. The variable is called "Data". I need to use http_post and pass this "Data" variable.
The servlet returns an xml file that I have logic to process.
Can any of you please advise on how to call the sevlet via http_post by passing a variable? If you have sample code that will be helpful

Regards
My objective is to call a servlet by passing an xml file. The servlet currently takes the input xml file and returns output as xml. I will need to take this xml parse and store it into oracle table.

I have an xml file that is stored as a blob in oracle. I am reading that blob. Since servlet that is coded is not capable of dealing with blob, I need to convert it into a character stream and send it.

I am having difficulty trying to do that. Please adivise.

Regards
Anoop
Hi! can anyone please suggest how to resolve the following issue.

I have a file that is saved as BLOB in oracle database. I am reading that into a "Blob" variable. After this I need to convert the blob into string.

I need to call a servlet that only is expecting a "String" as input.

Can anyone please suggest. If you have a sample code that will be helpful.

Regards
Anoop
Hi!
Can anyone please suggest how to use http_post to post an xml file ?
I need to pass an xml file to a webservice ussing http_post and parse the response that I get back from the webserice and store into a table.
Regards
Anoop
Hi!, while parsing an xml file, I am getting error that it is not able to resolve a url
(eg: <!DOCTYPE RootElement SYSTEM "http://www.mywebsite.com:80/dtds/testdtd_200609.dtd">. When I googled, there were suggestions that I need to use EntityResolver. But it is not working. Here is the code that I have. Ant help is greatly appreciated.

Regards


DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
docBuilder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(java.lang.String publicId,
java.lang.String systemId)
throws SAXException, java.io.IOException {
if (publicId.equals("--myDTDpublicID-"))
return new InputSource(new ByteArrayInputStream
("<?xml version='1.0' encoding='UTF-8'?>".getBytes()));
else return null;
}
});
Hello,

I need help/suggestion on how to resolve the following issue.
I need to read an xml file stored in as BLOB in an oracle table. I am able to read the file. I am stuck after this because, I am calling another java program to parse by passing in an XML file. Since I am not sure how to convert the BLOB to an xml file, I am getting no where. Any suggestions/help is greatly appreciated.
Here is what I need to do.
1. Read BLOB data type from xml
2. Convert the BLOB into an xml file and call the parser program with this
xml file as the parameter.

Regards
Anoop
16 years ago