Files and Libraries
The following files and libraries are available:
.NET Client Library
Created Oct 24, 2014 4:52:42 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( EngineInfos )
);
//Create the request object
WebRequest req = WebRequest.Create(uri);
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
TextReader r = new StreamReader( stream );
EngineInfos order = (EngineInfos) s.Deserialize( r );
//handle the result as needed...
This bundle contains C# source code.
Files
name | size |
---|---|
opsconsole-dotnet.zip | 18.48K |
Objective C Client Library
Created Oct 24, 2014 4:52:40 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 <opsconsole.h>
//...
OPSCONSOLENS0EngineInfos *requestElement = [[OPSCONSOLENS0EngineInfos alloc] init];
NSData *requestData; //data holding the XML for the request.
OPSCONSOLENS0EngineInfos *responseElement;
NSData *responseData; //data holding the XML from the response.
NSURL *baseURL = ...; //the base url including the host and subpath.
NSURL *url = [NSURL URLWithString: @"/engines/updatePreferences" 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 OPSCONSOLENS0EngineInfos...
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];
OPSCONSOLENS0EngineInfos *responseElement = [OPSCONSOLENS0EngineInfos readFromXML: responseData];
[responseElement retain];
//handle the response as needed...
Files
name | size | description |
---|---|---|
opsconsole.h | 122.62K | |
opsconsole.m | 1.03M | |
enunciate-common.h | 12.81K | Common header needed for all projects. |
enunciate-common.m | 42.61K | Common implementation code needed for all projects. |