Sending an XML using HTTP POST

Does anybody know anything about sending an XML file using HTTP POST?

I need to write a program that will do this. Havnt a clue about HTTP POST though. All I have to go on is an example HTTP POST used by an application to send an xml. To me it looks similar to SOAP, which I also know very little about.

I assume the information such as 'Content-length' and 'Content-type' do not go in the XML. Do I have to code them into my aplication or where do they go?

Any info would be greatly appreciated.

[525 byte] By [paul_carrona] at [2007-11-27 10:22:36]
# 1

You want to POST XML content, or you want to upload a file?

POST is HTTP headers, blank line, XML (or other data) content

file upload is multipart POST request, which is a little different.

Try looking at Apache's HttpClient , I'm sure it can handle either. And of course you need something on the server to handle it.

bsampieria at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 2

Caveat: I'm very new to Java too...

I have seen similar things done with JSP using the standard HTTP form stuff with "post" method:

<form name="<%=queryFormName%>" action="<%=queryAction%>" method="POST">

However ask someone more experienced if this would work in this case!

AliBa at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 3

if you want to use plain HTML to post content, you use HTML form and input tags. But presumably, the OP was about doing POST programatically from an application.

bsampieria at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 4

Need to use it to send an XML doc to a server but dont have a clue about it. Cant find much on the internet.

I intend to post it to an XAMP server. I already have my XML but as I say I know nothing about HTTP POST.

paul_carrona at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 5

http://jakarta.apache.org/commons/httpclient/features.html

bsampieria at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 6

You can also look up on google the html tag <input type="file">

George123a at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 7

Prob get slated for asking this but I dont know and they both look similar. Is HTTP POST an alternative to SOAP.

paul_carrona at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 8

No and sort of...

As far as I know, SOAP uses (or can use) HTTP POST.

SOAP is a higher level protocol. You can create your own protocol that uses HTTP POST if you want. (HTTP being a protocol of it's own built on top of TCP socket communication, of course.)

But POST is not, in and of itself, an alternative for SOAP.

bsampieria at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 9

Well does SOAP play any role in security?

paul_carrona at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...
# 10

SOAP is no more or less secure then anything else over HTTP... presumably one would use HTTPS with SOAP to make sure things are sent securely. But that's not the entire story of security...

You should get a book on SOAP.

bsampieria at 2007-7-28 17:17:02 > top of Java-index,Java Essentials,New To Java...