Question: Using Curl To Send Xml Post Request To Pdbe
gravatar for Mo Sander
2.7 years ago by
Mo Sander40
Mo Sander40 wrote:

I am trying to use cURL to send an XML POST request to a server hosting crystallographic data. I think I am going by the book, see below for the command I am using:

curl -X POST -H "Content-Type: text/xml" --data-urlencode '"><query><declaration><pfam name="p">PF00451</pfam></declaration></query>' <>

I used --trace-ascii to see the data sent to the server, it is the url-encoded version of my XML query specified above. The query is valid when entered as text into the submission form hosted on the server , but it returns an error when submitted with cURL.

Would anyone be aware of additional formatting that might be required by the server?

Thanks for your time!

A working example: curl -X POST -d 'requestXML="><query><declaration><pfam name="p">PF00451</pfam></declaration></query>' <>

ADD COMMENTlink modified 2.7 years ago by Pierre Lindenbaum58k • written 2.7 years ago by Mo Sander40
gravatar for Pierre Lindenbaum
2.7 years ago by
Pierre Lindenbaum58k wrote:

Your action URI is wrong. Use

instead of

moreover, look at the parameters of the HTML form, the XML document should be encoded and passed as an argument named requestXML

ADD COMMENTlink written 2.7 years ago by Pierre Lindenbaum58k

Hi Pierre, Thank you, the requestXML worked wonders! However, the action URI is the correct one. I pasted a working example: curl -X POST -d 'requestXML=<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE query SYSTEM "">[?][?][?]PF00451[?][?][?]'

ADD REPLYlink written 2.7 years ago by Mo Sander40
Please log in to add an answer.

  • RSS
  • Stats
  • API

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.0.0
Traffic: 766 users visited in the last hour