Java Reference
In-Depth Information
+ "\"customerId\":999,\"discountCode\":"
+ "{\"discountCode\":\"N\",\"rate\":0.00},"
+ "\"email\":\"customer@example.com\","
+ "\"fax\":\"555-555-1234\",\"name\":"
+ "\"Customer Name\",\"phone\":"
+ "\"555-555-2345\",\"state\":"
+ "\"AL\",\"zip\":{\"areaLength\":"
+ "547.967,\"areaWidth\":468.858,\""
+ "radius\":755.778,"
+ "\"zipCode\":\"12345\"}}";
NewJerseyClient newJerseyClient = new NewJerseyClient();
newJerseyClient.create_JSON(json);
newJerseyClient.close();
}
}
In the preceding client code, we generate JSON-formatted data so that our RESTful
web service can understand it, and pass it to the create_JSON() method in the
generated client class. This class in turn invokes our web service, which inserts
a row in the database.
Generating RESTful JavaScript clients
for our RESTful web services
In the previous section, we saw how to generate Java clients for our RESTful
web services. A common scenario is to develop RESTful web services in Java and
RESTful web service clients in JavaScript running in the browser. Just as NetBeans
can generate Java clients, it can also generate JavaScript clients for our RESTful
web services.
 
Search WWH ::




Custom Search