cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Question about HTTP Post

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 13 Dec 2001 13:26:05 +0100 (MET)

On Thu, 13 Dec 2001 christoph.vogler_at_sercon.de wrote:

> I have the following to do, and would like to know if it is possible:
>
> I have to Post a XML-File to an intranet-server,
> the URL is like:
> http://<ip>:<port>/invoke/service1/service2/
> The File needs following information:
>
> POST/invoke/wm.PartnerMgr.gateway.transport.BAPI/InboundProcesss
> HTTP/1.0

This is a malformed first line. In requires a space after the POST keyword.

> Content-Type:application/x-sap.busdoc
> User-Agent: Java.1.8
> Host:localhost:5555
> Accept: text(/htmlm image/gif, image/jpeg, *; q=.2, */*;q=.2

"text(/htmlm" ?

> Connection: keep-alive

If you only post one file, do you really need this? This "keep-alive" is by
the way HTTP 1.0-style only.

> Content-lenght: 817

Wrong spelling.

> <?xml version="1.0"encoding="iso-8859-1"?>

You need an empty line between the end of the headers and the start of the
body...

> Can anyone explain me how to Post it with curl, if it is possible, i´ve
> never worked with http posting things :-))

Store the full XML data in a file. Let's call it xml.txt for now:

1. To POST the data specified in the file use "-d @xml.txt"
2. You want that User-Agent header? Use "-A Java.1.8"
3. You need HTTP 1.0 rather than 1.1? Use --http1.0
4. You want that weird Accept: line? Use '-H "Accept: bla bla yada yada"'
5. Set that content-type with '-H "Content-Type:application/x-sap.busdoc"'
6. Append the URL
7. Write all options on one line
8. fire off ;-)

Good luck!

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-12-13