cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Parameters in URL not included

From: Alessandro Vesely <vesely_at_tana.it>
Date: Mon, 17 Dec 2007 19:19:18 +0100

Ron Stoll wrote:
> I am new to curl and have been trying to use it to send data to a SAP XI
> interface. XI requires various parameters to be included in the URL.
> When I run a trace these parameters seem to be chopped off and the XI
> application complains that information is missing. I have tried various
> options (-d and -F) to get the data included but I have had no success.
> Here is a sample of what I issue from the command line:
> curl --trace - -T test_file.xml
> http://address:8080/sap/xi/adapter_plain?service=MES_TESTsystem&namespace=urn:...&interface=MES...&qos=E0

I'm not familiar with SAP, thus I'm not sure what verb of the http protocol
it uses. Option -T implies PUT, while -d and -F are suited to POST or GET.

Since you have to upload a file along with other variables, a POST using -F
would seem a suitable way to do it. In that case you may try adding the xml
file as an additional form field. E.g., assuming "file" is its field name,

curl -F "file=@test_file.xml;type=text/xml" -F "service=MES_TESTsystem" ...

Besides trial and error, there are other ways to learn the proper verb if
you can send the data manually with a browser:

1) Study the html or javascript from the server. When forms are posted
from an html page, the latter contains a <form action=URL method=VERB>
tag, the default verb is GET, and the URL is the one you'll pass as
the main argument to curl. Field names come from the corresponding
<input> tags.

2) Watch it in action. Using liveHTTPheaders with the Firefox browser
lets you view protocol fields. If the connection is in clear text (i.e.
not an https:// url) you may also employ a packet sniffer to see the
whole communication between the browser and the server. It is fairly
straightforward to reproduce that communication exactly with curl.
Keep using --trace or -v to spot any difference.
Received on 2007-12-17