MRCGS API

C Client Library

Created Mar 28, 2011 6:59:06 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 <full.c> //... xmlTextWriterPtr writer = ...; //set up the writer to the url. full_data_person *request_element = ...; xmlTextReaderPtr reader = ...; //set up the reader to the url. full_data_person *response_element = ...; //set up the full_data_person... xml_write_full_data_person(writer, request_element); response_element = xml_read_full_data_person(reader); //handle the response as needed... //free the full_data_person free_full_data_person(request_element); //free the full_data_person free_full_data_person(response_element);

file size
full.c 335.04K

.NET Client Library

Created Mar 28, 2011 6:59:12 PM for .NET 2.0.

Introduction

The .NET client-side library may be used to access the SOAP API for this application via the .NET runtime.

.NET Service Example

//instantiate a new service... PersonService service = new PersonService(); //make the remote call... result = service.StorePerson(person); //handle the result as needed...

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( Person ) ); //Create the request object WebRequest req = WebRequest.Create(uri); WebResponse resp = req.GetResponse(); Stream stream = resp.GetResponseStream(); TextReader r = new StreamReader( stream ); Person order = (Person) s.Deserialize( r ); //handle the result as needed...

This bundle contains C# source code, the assembly, and the XML docs.

file size
full-dotnet.zip 18.13K

License

Created Dec 4, 2008 1:26:56 PM.

The license file governing these downloads.

file size
dummy-license.txt 29.00bytes

Java Client Library

Created Mar 28, 2011 6:59:12 PM for Java (Version 5+).

Introduction

The Java client-side library is used to access the Web service API for this application.

The Java client-side uses JAX-WS to access the SOAP API for this application.

JAX-WS Example

// instantiate a new service with an impl // (or through dependency injection, or whatever)... PersonService service = new PersonService(); //make the remote call to read the result... result = service.storePerson(person); //handle the result as needed...

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 + "/pedigree/person"); JAXBContext context = JAXBContext.newInstance( Person.class, Person.class ); java.net.URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.connect(); Unmarshaller unmarshaller = context.createUnmarshaller(); Marshaller marshaller = context.createMarshaller(); marshaller.marshal(person, connection.getOutputStream()); Person result = (Person) 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(); Person result = client.resource(baseUrl + "/pedigree/person") .entity(person) .put(Person.class); //handle the result as needed...

Files

file size description
full-client.jar 64.55K The binaries for the Java client library.
full-client-sources.jar 42.16K The sources for the Java client library.

Java JSON Client Library

Created Mar 28, 2011 6:59:12 PM for Java (Version 5+).

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 + "/pedigree/person"); ObjectMapper mapper = new ObjectMapper(); java.net.URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.connect(); mapper.writeValue(connection.getOutputStream(), person); Person result = (Person) mapper.readValue( connection.getInputStream(), Person.class ); //handle the result as needed...

Files

file size description
full-json-client.jar 20.37K The binaries for the Java JSON client library.
full-json-client-sources.jar 14.95K The sources for the Java JSON client library.

Objective C Client Library

Created Mar 28, 2011 6:59:07 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 <full.h> //... FULLDATAPerson *requestElement = [[FULLDATAPerson alloc] init]; NSData *requestData; //data holding the XML for the request. FULLDATAPerson *responseElement; NSData *responseData; //data holding the XML from the response. NSURL *baseURL = ...; //the base url including the host and subpath. NSURL *url = [NSURL URLWithString: @"/pedigree/person" relativeToURL: baseURL]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; NSURLResponse *response = nil; NSError *error = NULL; [request setHTTPMethod: @"PUT"]; [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"]; //set up the FULLDATAPerson... 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]; FULLDATAPerson *responseElement = [FULLDATAPerson readFromXML: responseData]; [responseElement retain]; //handle the response as needed...

Files

file size description
full.h 24.92K
full.m 255.43K