Introduction
The following items are available for download:
C Client Library
Created Oct 3, 2012 5:06:30 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 <nexus-usertoken-plugin.c>
//...
xmlTextWriterPtr writer = ...; //set up the writer to the url.
nexus_usertoken_plugin_api_settings *request_element = ...;
xmlTextReaderPtr reader = ...; //set up the reader to the url.
nexus_usertoken_plugin_api_settings *response_element = ...;
//set up the nexus_usertoken_plugin_api_settings...
xml_write_nexus_usertoken_plugin_api_settings(writer, request_element);
response_element = xml_read_nexus_usertoken_plugin_api_settings(reader);
//handle the response as needed...
//free the nexus_usertoken_plugin_api_settings
free_nexus_usertoken_plugin_api_settings(request_element);
//free the nexus_usertoken_plugin_api_settings
free_nexus_usertoken_plugin_api_settings(response_element);
Files
file | size | description |
---|---|---|
nexus-usertoken-plugin.c | 83.12K | |
enunciate-common.c | 38.69K | Common code needed for all projects. |
Java Client Library
Created Oct 3, 2012 5:06:31 PM for Java (Version 5+).
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 + "/usertoken/settings");
JAXBContext context = JAXBContext.newInstance( SettingsXO.class, SettingsXO.class );
java.net.URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.connect();
Unmarshaller unmarshaller = context.createUnmarshaller();
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(settingsXO, connection.getOutputStream());
SettingsXO result = (SettingsXO) 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();
SettingsXO result = client.resource(baseUrl + "/usertoken/settings")
.entity(settingsXO)
.put(SettingsXO.class);
//handle the result as needed...
Files
file | size | description |
---|---|---|
nexus-usertoken-plugin-client.jar | 5.46K | The binaries for the Java client library. |
nexus-usertoken-plugin-client-sources.jar | 3.15K | The sources for the Java client library. |
Objective C Client Library
Created Oct 3, 2012 5:06:30 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 <nexus-usertoken-plugin.h>
//...
NEXUS_USERTOKEN_PLUGINAPISettingsXO *requestElement = [[NEXUS_USERTOKEN_PLUGINAPISettingsXO alloc] init];
NSData *requestData; //data holding the XML for the request.
NEXUS_USERTOKEN_PLUGINAPISettingsXO *responseElement;
NSData *responseData; //data holding the XML from the response.
NSURL *baseURL = ...; //the base url including the host and subpath.
NSURL *url = [NSURL URLWithString: @"/usertoken/settings" 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 NEXUS_USERTOKEN_PLUGINAPISettingsXO...
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];
NEXUS_USERTOKEN_PLUGINAPISettingsXO *responseElement = [NEXUS_USERTOKEN_PLUGINAPISettingsXO readFromXML: responseData];
[responseElement retain];
//handle the response as needed...
Files
file | size | description |
---|---|---|
nexus-usertoken-plugin.h | 3.78K | |
nexus-usertoken-plugin.m | 66.11K | |
enunciate-common.h | 12.22K | Common header needed for all projects. |
enunciate-common.m | 41.77K | Common implementation code needed for all projects. |