This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Using Curl To Send Xml Post Request To Pdbe

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 'http://www.ebi.ac.uk/pdbe-site/pdbemotif/query.dtd"><query><declaration><pfam name="p">PF00451</pfam></declaration></query>' <http://www.ebi.ac.uk/pdbe-site/pdbemotif/hitlist.xml>

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 http://www.ebi.ac.uk/pdbe-site/pdbemotif/xmlqueryprint.jsp , 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= http://www.ebi.ac.uk/pdbe-site/pdbemotif/query.dtd"><query><declaration><pfam name="p">PF00451</pfam></declaration></query>' <http://www.ebi.ac.uk/pdbe-site/pdbemotif/hitlist.xml>

pdb xml

1 answer

Your action URI is wrong. Use

http://www.ebi.ac.uk/pdbe-site/pdbemotif/hitlist

instead of

http://www.ebi.ac.uk/pdbe-site/pdbemotif/hitlist.xml

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

Log in to answer this question.