Files and Libraries
The following files and libraries are available:
- License
- C Client Library
- .NET Client Library
- Java Client Library
- Java JSON Client Library
- Objective C Client Library
License
Created Aug 5, 2013 10:42:53 AM
The license file governing the use of this API.
Files
name | size |
---|---|
LICENSE.txt | 457.00bytes |
C Client Library
Created Apr 16, 2015 12:23:22 PM
Introduction
The C module generates the source code for the ANSI-C-compatible data structures and (de)serialization functions that can be used in conjunction with libxml2 to (de)serialize the REST resources as they are represented as XML data.
The generated C source code depends on the XML Reader API and the XML Writer API as well as the <time.h>, <string.h>, and <stdlib.h> C standard libraries.
REST XML Example
#include <Virtual Trainer API.c>
//...
xmlTextWriterPtr writer = ...; //set up the writer to the url.
Virtual_Trainer_API_user_LFUser *request_element = ...;
xmlTextReaderPtr reader = ...; //set up the reader to the url.
Virtual_Trainer_API_user_LFUser *response_element = ...;
//set up the Virtual_Trainer_API_user_LFUser...
xml_write_Virtual_Trainer_API_user_LFUser(writer, request_element);
response_element = xml_read_Virtual_Trainer_API_user_LFUser(reader);
//handle the response as needed...
//free the Virtual_Trainer_API_user_LFUser
free_Virtual_Trainer_API_user_LFUser(request_element);
//free the Virtual_Trainer_API_user_LFUser
free_Virtual_Trainer_API_user_LFUser(response_element);
Files
name | size | description |
---|---|---|
Virtual Trainer API.c | 932.35K | |
enunciate-common.c | 39.70K | Common code needed for all projects. |
.NET Client Library
Created Apr 16, 2015 12:23:32 PM
Introduction
The .NET client-side library defines the classes that can be (de)serialized to/from XML. This is useful for accessing the REST endpoints that are published by this application.
REST Example
//read a resource from a REST url
Uri uri = new Uri(...);
XmlSerializer s = new XmlSerializer(
typeof( LFUser )
);
//Create the request object
WebRequest req = WebRequest.Create(uri);
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
TextReader r = new StreamReader( stream );
LFUser order = (LFUser) s.Deserialize( r );
//handle the result as needed...
This bundle contains C# source code.
Files
name | size |
---|---|
Virtual Trainer API-dotnet.zip | 9.69K |
Java Client Library
Created Apr 16, 2015 12:23:32 PM
Introduction
The Java client-side library is used to access the Web service API for this application.
The JAX-WS client-side library is used to provide the set of Java objects that can be serialized to/from XML using JAXB. This is useful for accessing the REST endpoints that are published by this application.
REST Example (Raw JAXB)
java.net.URL url = new java.net.URL(baseURL + "/user");
JAXBContext context = JAXBContext.newInstance( LFUser.class, LFUser.class );
java.net.URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.connect();
Unmarshaller unmarshaller = context.createUnmarshaller();
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(lFUser, connection.getOutputStream());
LFUser result = (LFUser) unmarshaller.unmarshal( connection.getInputStream() );
//handle the result as needed...
REST Example (Jersey client)
com.sun.jersey.api.client.Client client = com.sun.jersey.api.client.Client.create();
LFUser result = client.resource(baseUrl + "/user")
.entity(lFUser)
.post(LFUser.class);
//handle the result as needed...
Files
name | size | description |
---|---|---|
Virtual Trainer API-client.jar | 45.26K | The binaries for the Java client library. |
Virtual Trainer API-client-sources.jar | 28.25K | The sources for the Java client library. |
Java JSON Client Library
Created Apr 16, 2015 12:23:33 PM
Introduction
The Java client-side library is used to provide the set of Java objects that can be serialized to/from JSON using Jackson. This is useful for accessing the JSON REST endpoints that are published by this application.
REST Example (Raw Jackson)
java.net.URL url = new java.net.URL(baseURL + "/user");
ObjectMapper mapper = new ObjectMapper();
java.net.URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.connect();
mapper.writeValue(connection.getOutputStream(), lFUser);
LFUser result = (LFUser) mapper.readValue( connection.getInputStream(), LFUser.class );
//handle the result as needed...
Files
name | size | description |
---|---|---|
Virtual Trainer API-json-client.jar | 33.74K | The binaries for the Java JSON client library. |
Virtual Trainer API-json-client-sources.jar | 26.58K | The sources for the Java JSON client library. |
Objective C Client Library
Created Apr 16, 2015 12:23:24 PM
Introduction
The Objective C module generates the source code for the Objective C classes and (de)serialization functions that can be used in conjunction with libxml2 to (de)serialize the REST resources as they are represented as XML data.
The generated Objective C source code depends on the XML Reader API and the XML Writer API as well as the base OpenStep foundation classes.
REST XML Example
#import <Virtual Trainer API.h>
//...
VIRTUAL_TRAINER_APIUSERLFUser *requestElement = [[VIRTUAL_TRAINER_APIUSERLFUser alloc] init];
NSData *requestData; //data holding the XML for the request.
VIRTUAL_TRAINER_APIUSERLFUser *responseElement;
NSData *responseData; //data holding the XML from the response.
NSURL *baseURL = ...; //the base url including the host and subpath.
NSURL *url = [NSURL URLWithString: @"/user" relativeToURL: baseURL];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSURLResponse *response = nil;
NSError *error = NULL;
[request setHTTPMethod: @"POST"];
[request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
//set up the VIRTUAL_TRAINER_APIUSERLFUser...
requestData = [requestElement writeToXML];
[request setHTTPBody: requestData];
//this example uses a synchronous request,
//but you'll probably want to use an asynchronous call
responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
VIRTUAL_TRAINER_APIUSERLFUser *responseElement = [VIRTUAL_TRAINER_APIUSERLFUser readFromXML: responseData];
[responseElement retain];
//handle the response as needed...
Files
name | size | description |
---|---|---|
Virtual Trainer API.h | 51.87K | |
Virtual Trainer API.m | 611.31K | |
enunciate-common.h | 12.81K | Common header needed for all projects. |
enunciate-common.m | 42.61K | Common implementation code needed for all projects. |