Introduction
The following items are available for download:
C Client Library
Created Aug 21, 2012 9:17:46 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-staging-plugin.c>
//...
xmlTextWriterPtr writer = ...; //set up the writer to the url.
nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO *request_element = ...;
xmlTextReaderPtr reader = ...; //set up the reader to the url.
nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO *response_element = ...;
//set up the nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO...
xml_write_nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO(writer, request_element);
response_element = xml_read_nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO(reader);
//handle the response as needed...
//free the nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO
free_nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO(request_element);
//free the nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO
free_nexus_staging_plugin_ns0_stagingProfileOrderRequestDTO(response_element);
file | size |
---|---|
nexus-staging-plugin.c | 221.86K |
.NET Client Library
Created Aug 21, 2012 9:17:48 PM for .NET 2.0.
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( StagingProfileOrderRequestDTO )
);
//Create the request object
WebRequest req = WebRequest.Create(uri);
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
TextReader r = new StreamReader( stream );
StagingProfileOrderRequestDTO order = (StagingProfileOrderRequestDTO) s.Deserialize( r );
//handle the result as needed...
This bundle contains C# source code.
file | size |
---|---|
nexus-staging-plugin-dotnet.zip | 2.05K |
JAX-WS Client Library (Java 5+)
Created Aug 21, 2012 9:17:48 PM for Java (Version 5+).
Introduction
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 + "/staging/profile_order");
JAXBContext context = JAXBContext.newInstance( StagingProfileOrderRequestDTO.class, StagingProfileOrderRequestDTO.class );
java.net.URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.connect();
Unmarshaller unmarshaller = context.createUnmarshaller();
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(stagingProfileOrderRequestDTO, connection.getOutputStream());
StagingProfileOrderRequestDTO result = (StagingProfileOrderRequestDTO) 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();
StagingProfileOrderRequestDTO result = client.resource(baseUrl + "/staging/profile_order")
.entity(stagingProfileOrderRequestDTO)
.post(StagingProfileOrderRequestDTO.class);
//handle the result as needed...
Files
file | size | description |
---|---|---|
nexus-staging-plugin-client.jar | 10.77K | The binaries for the JAX-WS client library. |
nexus-staging-plugin-client-sources.jar | 6.18K | The sources for the JAX-WS client library. |
Objective C Client Library
Created Aug 21, 2012 9:17:47 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
#include <nexus-staging-plugin.h>
//...
NEXUS_STAGING_PLUGINNS0StagingProfileOrderRequestDTO *requestElement = [[NEXUS_STAGING_PLUGINNS0StagingProfileOrderRequestDTO alloc] init];
NSData *requestData; //data holding the XML for the request.
NEXUS_STAGING_PLUGINNS0StagingProfileOrderRequestDTO *responseElement;
NSData *responseData; //data holding the XML from the response.
NSURL *baseURL = ...; //the base url including the host and subpath.
NSURL *url = [NSURL URLWithString: @"/staging/profile_order" 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 NEXUS_STAGING_PLUGINNS0StagingProfileOrderRequestDTO...
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_STAGING_PLUGINNS0StagingProfileOrderRequestDTO *responseElement = [NEXUS_STAGING_PLUGINNS0StagingProfileOrderRequestDTO readFromXML: responseData];
[responseElement retain];
//handle the response as needed...
Files
file | size | description |
---|---|---|
nexus-staging-plugin.h | 15.55K | |
nexus-staging-plugin.m | 176.84K |