Related to https://docs.wso2.org/display/DSS320/JSON+Mapping+Sample,

It would be great if the DSS sample can give the full curl commands.


I tried the following command,

curl -X POST -H 'Accept: application/json'  -H 'ContentType:
application/json' --data "@employee-payload.json"
http://localhost:9763/services/samples/JSONSample/employee/


The employee-payload.json has the following payload:


{

  "_postemployee": {

    "employeeNumber" : "14001",

    "lastName": "Smith",

    "firstName": "Will",

    "email": "w...@google.com",

    "salary": "15500.0"

  }

}



However, this call results in the following error;


<html><head><title>Apache Tomcat/7.0.34 - Error report</title><style><!--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;}--></style>
</head><body><h1>HTTP Status 500 - String index out of range: -1</h1><HR
size="1" noshade="noshade"><p><b>type</b> Exception
report</p><p><b>message</b> <u>String index out of range:
-1</u></p><p><b>description</b> <u>The server encountered an internal error
that prevented it from fulfilling this request.</u></p><p><b>exception</b>
<pre>java.lang.StringIndexOutOfBoundsException: String index out of range:
-1

java.lang.String.substring(String.java:1911)

org.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromRequest(XFormURLEncodedBuilder.java:174)

org.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURLEncodedBuilder.java:112)

org.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.doPost(AxisServlet.java:227)

org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)

javax.servlet.http.HttpServlet.service(HttpServlet.java:755)

 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)

</pre></p><p><b>note</b> <u>The full stack trace of the root cause is
available in the Apache Tomcat/7.0.34 logs.</u></p><HR size="1"
noshade="noshade"><h3>Apache Tomcat/7.0.34</h3></body></html>


What is missing in the curl command?

-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>*
*email: **az...@wso2.com* <az...@wso2.com>
* cell: +94 77 3320919 blog: **http://blog.afkham.org*<http://blog.afkham.org>
*twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
* linked-in: **http://lk.linkedin.com/in/afkhamazeez
<http://lk.linkedin.com/in/afkhamazeez>*

*Lean . Enterprise . Middleware*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to