Note that there are some explanatory texts on larger screens.

plurals
  1. POcurl POST to RESTful services
    primarykey
    data
    text
    <p>There are a lot of questions on Stackoverflow about curl but I could not figure out what is that I am doing what I am not supposed to. I am trying to call a RESTful service that I had written using Jersey API and am trying to POST an xml string to it and I get HTTP 415 error which is supposed to be a Media Type error.</p> <p>Here in my shell script call to 1st service:</p> <p>abc=<code>curl http://gf...:8080/InChItoD/inchi/3dstructure?InChIstring=$inchi</code></p> <p>echo $abc (this works fine the output that it returns is given below.)</p> <p>Posting this xml string to second service</p> <p>def= <code>curl -d $abc -H "Content-Type:text/xml" http://gf...:8080/XML2G/xml3d/gssinput</code></p> <p>I get the following error:</p> <p>... ... HTTP Status 415 Status report message description.The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().Apache Tomcat/6.0.26</p> <p>This is a sample of xml string I am trying to POST</p> <p><code>&lt;?xml version="1.0"?&gt;&lt;molecule xmlns="http://www.xml-cml.org/schema"&gt; &lt;atomArray&gt; &lt;atom id="a1" elementType="N" formalCharge="1" x3="0.997963" y3="-0.002882" z3="-0.004222"/&gt; &lt;atom id="a2" elementType="H" x3="2.024650" y3="-0.002674" z3="0.004172"/&gt; &lt;atom id="a3" elementType="H" x3="0.655444" y3="0.964985" z3="0.004172"/&gt; &lt;atom id="a4" elementType="H" x3="0.649003" y3="-0.496650" z3="0.825505"/&gt; &lt;atom id="a5" elementType="H" x3="0.662767" y3="-0.477173" z3="-0.850949"/&gt; &lt;/atomArray&gt; &lt;bondArray&gt; &lt;bond atomRefs2="a1 a2" order="1"/&gt; &lt;bond atomRefs2="a1 a3" order="1"/&gt; &lt;bond atomRefs2="a1 a4" order="1"/&gt; &lt;bond atomRefs2="a1 a5" order="1"/&gt; &lt;/bondArray&gt;&lt;/molecule&gt;</code></p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload