title: curl errors: could not resolve host, java.lang.StringIndexOutOfBoundsException: String index out of range: -1
body: <p>Sorry for posting this as this might be a simple problems to experts but to me as a beginner it is an important issue to resolve. I have created a <code>WSO2 DSS service</code> where it has a <code>MYSQL</code> table datasource named <code>users(userid(auto_increment),first_name,last_name,password).</code></p>
  
  <p>I created specific queries for GET, POST, PUT, DELETE and also resources to accommodate these request. When I started testing the service using cURL GET and DELETE, it was working and I was able to retrieve and delete data. However when I was trying to insert (POST) and update (PUT) data I'm getting multiple errors
  shown below:</p>
  
  <pre><code>curl: (6) Could not resolve host: first_name curl: (6) Could not
   resolve host: last_name curl: (6) Could not resolve host: password
   HTTP/1.1 500 Internal Server Error Access-Control-Allow-Headers:
   authorization,Access-Control-Allow-Origin,Content-Type Vary:
   Accept-Encoding Content-Type: text/html;charset=utf-8 Date: Fri, 08
   Aug 2014 05:05:43 GMT Server: WSO2-PassThrough-HTTP Transfer-Encoding:
   chunked
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/7.0.34 - Error
   report&lt;/title&gt;&lt;style&gt;&lt;!--H1
   {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
   H2
   {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
   H3
   {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
   BODY
   {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
   B
   {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P
   {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
   {color : black;}A.name {color : black;}HR {color :
   #525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 500 - String index out of range: 1&lt;/h1&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt;
   Exception report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt;String index out of range:
   -1&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;The server encountered an internal error that prevented t from fulfilling this
   request.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;exception&lt;/b&gt;
   &lt;pre&gt;java.lang.StringIndexOutOfBoundsException: String index out of
   range: -1
           java.lang.String.substring(String.java:1911)
           rg.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromRequest(XFormURLEncodedBilder.java:174)
           rg.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURLEncodedBuilder.java:12)
           rg.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:188)
           org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:146)
           org.apache.axis2.transport.http.util.RESTUtil.processXMLRequest(RESTUtil.java:65)
           org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processXMLRequest(AxisServlet.java:826)
           org.apache.axis2.transport.http.AxisServlet.doPut(AxisServlet.java:317)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:758)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
           org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
           org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
           org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
           org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
           org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
  </code></pre>
  
  <p>Here are the cURL commands that I used:</p>
  
  <pre><code>POST - curl -i -H "Authorization: Bearer f56ce778dee04274eba0eab3e9d7b324" -H "Accept: application/json" -X POST -d {"first_name":"chris","last_name":"paul","password":"cp3"} http://ip:port/SampleDSS/user/
  
  PUT - curl -i -H "Authorization: Bearer f56ce778dee04274eba0eab3e9d7b324" -H "Accept: application/json" -X PUT -d {"userid":11,"first_name":"chris","last_name":"paul","password":"cp3"} http://ip:port/SampleDSS/user/
  </code></pre>
  
  <p>Can you please point out if there is any prob with the <code>cURL</code> command or the <code>JSON</code> format data that I'm using?</p>
  
  <p>Any substantial help would be welcomed. </p>
  
  <p>Thank you very much!</p>