Author: robertlazarski
Date: Thu Mar 12 19:50:49 2020
New Revision: 1875140

URL: http://svn.apache.org/viewvc?rev=1875140&view=rev
Log:
AXIS2-5943 fix samples/json client code

Modified:
    axis/axis2/java/core/trunk/modules/samples/json/README.txt
    
axis/axis2/java/core/trunk/modules/samples/json/src/sample/json/client/JsonClient.java

Modified: axis/axis2/java/core/trunk/modules/samples/json/README.txt
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/samples/json/README.txt?rev=1875140&r1=1875139&r2=1875140&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/samples/json/README.txt (original)
+++ axis/axis2/java/core/trunk/modules/samples/json/README.txt Thu Mar 12 
19:50:49 2020
@@ -9,19 +9,24 @@ convention.
 
 In this sample it sends
 
-{"echoUser":{"user":{"name":"My_Name","surname":"MY_Surname","middleName":"My_MiddleName","age":123,
-    
"address":{"country":"My_Country","city":"My_City","street":"My_Street","building":"My_Building","flat":"My_Flat","zipCode":"My_ZipCode"}}}}
+{"echoUser":[{"arg0":{"name":My_Name,"surname":MY_Surname,"middleName":My_MiddleName,"age":123
+,"address":{"country":My_Country,"city":My_City,"street":My_Street,"building":My_Building,"fla
+t":My_Flat,"zipCode":My_ZipCode}}}]}
+
 
 JSON request to the echoUser method and get the response as
 
 
{"Response":{"name":"My_Name","surname":"MY_Surname","middleName":"My_MiddleName","age":123,
     
"address":{"country":"My_Country","city":"My_City","street":"My_Street","building":"My_Building","flat":"My_Flat","zipCode":"My_ZipCode"}}}
 
+Note that the above request String could be placed into a file myjson.dat and 
used with curl:
+
+curl -v -H "Content-Type: application/json" -X POST --data @/root/myjson.dat 
http://localhost:8080/axis2/services/JsonService/echoUser
 
 Pre-Requisites
 ==============
 
-Apache Ant 1.6.2 or later
+Apache Ant 1.8 or later
 
 Running The Sample
 ==================
@@ -43,4 +48,4 @@ Then type "ant run.client" to compile cl
 
 Help
 ====
-Please contact axis-user list (axis-u...@ws.apache.org) if you have any 
trouble running the sample.
\ No newline at end of file
+Please contact axis-user list (axis-u...@ws.apache.org) if you have any 
trouble running the sample.

Modified: 
axis/axis2/java/core/trunk/modules/samples/json/src/sample/json/client/JsonClient.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/samples/json/src/sample/json/client/JsonClient.java?rev=1875140&r1=1875139&r2=1875140&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/samples/json/src/sample/json/client/JsonClient.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/samples/json/src/sample/json/client/JsonClient.java
 Thu Mar 12 19:50:49 2020
@@ -31,13 +31,11 @@ import java.io.UnsupportedEncodingExcept
 public class JsonClient{
 
     private String url = 
"http://localhost:8080/axis2/services/JsonService/echoUser";;
-    private String contentType = "application/json-impl";
+    private String contentType = "application/json";
     private String charSet = "UTF-8";
 
     public static void main(String[] args)throws IOException {
-        String echoUser = 
"{\"echoUser\":{\"user\":{\"name\":\"My_Name\",\"surname\":\"MY_Surname\",\"middleName\":"
 +
-            
"\"My_MiddleName\",\"age\":123,\"address\":{\"country\":\"My_Country\",\"city\":\"My_City\",\"street\":"
 +
-            
"\"My_Street\",\"building\":\"My_Building\",\"flat\":\"My_Flat\",\"zipCode\":\"My_ZipCode\"}}}}";
+       String echoUser = 
"{\"echoUser\":[{\"arg0\":{\"name\":\"My_Name\",\"surname\":\"MY_Surname\",\"middleName\":"
 + 
"\"My_MiddleName\",\"age\":123,\"address\":{\"country\":\"My_Country\",\"city\":\"My_City\",\"street\":"
 + 
"\"My_Street\",\"building\":\"My_Building\",\"flat\":\"My_Flat\",\"zipCode\":\"My_ZipCode\"}}}]}";
 
         JsonClient jsonClient = new JsonClient();
         jsonClient.post(echoUser);


Reply via email to