PDA

View Full Version : HTTP Post without header


olli
03-21-2005, 03:52
Hi,

is it possible to post a RAW request using pub.client:http service ?
normally a default header is added :

POST / HTTP/1.0
User-Agent: Mozilla/4.0 [en] (WinNT; I)
Accept: image/gif, */*
Host:
Authorization: Basic Og==
Content-type: application/x-www-form-urlencoded
Content-Length: 50

can this be left out easily ? if not, what is the alternative ?

thx,
Oliver.

sonam
03-21-2005, 19:58
No, it's not possible. What you're asking for is not an HTTP request but a simple TCP connection like the one provided by 'telnet'.

To do what you want, you can write a simple Java service - it should just take a few lines. The service would need 3 inputs: an object (data bytes), remote server address, remote server port. All you have to do is open a TCP socket to the remote endpoint and write the data out to it.

olli
03-22-2005, 02:09
Hi Sonam,

thx for the reply.
Can you give me an example how to build that Java Service. I'm not very experienced with it.

thx,
Oliver.

sonam
04-07-2005, 01:33
Sorry I didn't reply earlier Oliver.

My Java is rusty, so I won't give you code. However, writing a Java service isn't difficult. Make sure you import java.io.* in the imports tab for the Java service. What you will be doing is called 'socket programming' and the techniques shown here should suffice:
http://www.oreilly.com/catalog/javaio/chapter/ch05.html#28144

This page showed when I googled for "import java.io.* network connection" (http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=deskbar&q=import%2Bjava.io.*%2Bnetwork%2Bconnection)