ソースを参照

xmlrpc implementado

robert2206 8 年 前
コミット
37209d9694

+ 37 - 33
src/models/sale.order.ts

@@ -4,42 +4,46 @@ import { BaseModel } from "./base.model";
 // @Reflect.metadata("endpoint", "sale_order")    
 export class SaleOrder extends BaseModel {
 
-    public amount_tax: number;
-    public amount_total: number;
-    public amount_untaxed: number;
-    public date_confirm: string;
-    public date_order: string;
-    public display_name: string;
-    public invoiced: boolean;
-    public invoiced_rate: number;
-    public invoide_exist: boolean;
-    public name: string;
-    public order_line: Array<any>;
-    public partner_id: number;
-    public pricelist_id: number;
-    public product_id: number;
-    public state: number;
-    public user_id: number;
-    public warehouse_id: number;
+    // public amount_tax: number;
+    // public amount_total: number;
+    // public amount_untaxed: number;
+    // public date_confirm: string;
+    // public date_order: string;
+    // public display_name: string;
+    // public invoiced: boolean;
+    // public invoiced_rate: number;
+    // public invoide_exist: boolean;
+    // public name: string;
+    // public order_line: Array<any>;
+    // public partner_id: number;
+    // public pricelist_id: number;
+    // public product_id: number;
+    // public state: number;
+    // public user_id: number;
+    // public warehouse_id: number;
+
+    public customer: any;
+    public lines: Array<any>;
+    public total: number;
 
     constructor() { 
         super();
 
-        this.amount_tax = 0;
-        this.amount_total = 0;
-        this.amount_untaxed = 0;
-        this.date_confirm = null;
-        this.date_order = null;
-        this.display_name = null;
-        this.invoiced = false;
-        this.invoiced_rate = 0;
-        this.invoide_exist = false;
-        this.name = null;
-        this.order_line = [];
-        this.partner_id = 0;
-        this.product_id = 0;
-        this.state = null;
-        this.user_id = 0;
-        this.warehouse_id = 0;
+        // this.amount_tax = 0;
+        // this.amount_total = 0;
+        // this.amount_untaxed = 0;
+        // this.date_confirm = null;
+        // this.date_order = null;
+        // this.display_name = null;
+        // this.invoiced = false;
+        // this.invoiced_rate = 0;
+        // this.invoide_exist = false;
+        // this.name = null;
+        // this.order_line = [];
+        // this.partner_id = 0;
+        // this.product_id = 0;
+        // this.state = null;
+        // this.user_id = 0;
+        // this.warehouse_id = 0;
     }
 }

+ 15 - 3
src/pages/sale-order-details/sale-order-details.ts

@@ -1,7 +1,8 @@
 import { Component, ViewChild } from "@angular/core";
-import { NavController, Slides, Searchbar, AlertController, ToastController } from "ionic-angular";
+import { NavController, NavParams, Slides, Searchbar, AlertController, ToastController } from "ionic-angular";
 import { Keyboard } from "ionic-native";
 import { DetailsView } from "../../defaults/default-details-view";
+import { SaleOrderListPage } from "../../pages/sale-order-list/sale-order-list";
 import { SaleOrder } from "../../models/sale.order";
 import { Partner } from "../../models/partner";
 import { Product } from "../../models/product";
@@ -41,6 +42,7 @@ export class SaleOrderDetailsPage extends DetailsView<SaleOrder> {
   
     constructor(
         public navCtrl: NavController,
+        public navParams: NavParams,
         public alertCtrl: AlertController,
         public toastCtrl: ToastController,
         public db: DataProvider,
@@ -395,14 +397,24 @@ export class SaleOrderDetailsPage extends DetailsView<SaleOrder> {
      *
      */
     saveSale(): void {
-        let saleOrder = {
+        let saleOrder: SaleOrder = {
+            id: null,
+            doc_state: "created",
+            remote_id: 0,
+            create_date: null,
+            write_date: null,
             customer: this.customer,
             lines: this.lines,
             total: this.total
         };
         
         this.db.save(DataProvider.DOCS.SALE_ORDER, saleOrder).then(result => {
-            this.events.publish(Slots.ITEM_CREATE, result);
+            console.log(result);
+            
+            if (this.navParams.data instanceof SaleOrderListPage) {
+                this.navParams.data.add(result);
+            }
+            
             this.navCtrl.pop(this);
         }).catch(error => {
             console.log(error);

+ 19 - 1
src/pages/sale-order-list/sale-order-list.html

@@ -1,7 +1,25 @@
 <olist-header title="Presupuestos" (toggle)="toggleSearch()" (search)="search($event)"></olist-header>
 
 <ion-content class="has-header">
-    <olist-footer [hasElements]="hasItems()" (create)="goToPage(null)"></olist-footer>
+      <ion-card *ngFor="let s of visibleElements; trackBy:trackByElements">
+          <ion-item>
+                <h2>{{ s.customer.name }}</h2>
+                <p>
+                    <strong>Fecha:</strong>
+                    {{ s.write_date }}
+                </p>
+                <p>
+                    <strong>Cantidad de items:</strong>
+                    {{ s.lines.length }}
+                </p>
+                <p>
+                    <strong>Total:</strong>
+                    {{ s.total }}
+                </p>
+          </ion-item>
+      </ion-card>
+
+    <olist-footer [hasElements]="hasVisibleElements()" (create)="goToPage(null)"></olist-footer>
 </ion-content>
 
 

+ 40 - 8
src/pages/sale-order-list/sale-order-list.ts

@@ -1,7 +1,8 @@
 import { Component } from "@angular/core";
-import { NavController } from "ionic-angular";
-import { ListView } from "../../defaults/default-list-view";
+import { NavController, LoadingController } from "ionic-angular";
+import { DefaultListable } from "../../defaults/default-listable";
 import { INavigable } from "../../interfaces/navigable-interface";
+import { DataProvider } from "../../providers/data-provider";
 import { SaleOrderDetailsPage } from "../../pages/sale-order-details/sale-order-details";
 import { SaleOrder } from "../../models/sale.order";
 import { Slots } from "../../utils/slots";
@@ -10,20 +11,51 @@ import { Slots } from "../../utils/slots";
     selector: 'page-sale-order-list',
     templateUrl: 'sale-order-list.html'
 })
-export class SaleOrderListPage extends ListView<SaleOrder> implements INavigable {
+export class SaleOrderListPage extends DefaultListable<SaleOrder> implements INavigable {
 
     constructor(
-        public navCtrl: NavController
+        public navCtrl: NavController,
+        public loadingController: LoadingController,
+        public db: DataProvider
     ) {
-        super(SaleOrder);
+        super(loadingController);
     }
 
+    /**
+     *
+     */
+    ionViewDidLoad() {
+        this.initialize();
+    }
+
+    /**
+     *
+     */
+    initialize(): void {
+        let loader = this.loadingCtrl.create({
+            content: "Cargando presupuestos, espere.."
+        });
+        loader.present();
+
+        this.db.getAll(DataProvider.DOCS.SALE_ORDER).then(results => {
+            this.elements = results.filter(item => {
+                return item.doc_state != "deleted";
+            });
+
+
+            loader.dismiss();
+        }).catch(error => {
+            console.log(error);
+            
+            loader.dismiss();
+        });
+    }
+
+
     /**
      *
      */
     goToPage(data: any): void {
-        console.log(data);
-        
-        this.navCtrl.push(SaleOrderDetailsPage, data);
+        this.navCtrl.push(SaleOrderDetailsPage, data ? data : this);
     }
 }

+ 132 - 0
src/providers/xmlrpc/js-to-xml.ts

@@ -0,0 +1,132 @@
+import { XmlRpcHelper } from "./xmlrpc-helper";
+
+export class JsToXml {
+
+    jsToXmlMethod: any;
+
+    constructor(
+        private helper: XmlRpcHelper
+    ) {
+        this.jsToXmlMethod = [
+            { 'string': this.stringToXml },
+            { 'number': this.numberToXml },
+            { 'boolean': this.booleanToXml },
+            { 'array': this.arrayToXml },
+            { 'object': this.structToXml },
+            { 'date': this.dateToXml },
+            { 'uint8array': this.uint8arrayToXml }
+        ];
+    }
+
+    /**
+     *
+     */
+    nullToXml(doc) {
+        return this.helper.createNode(doc, 'nil');
+    }
+
+    /**
+     *
+     */
+    stringToXml(doc: any, input: any): any {
+        return this.helper.createNode(doc, 'string', input);
+    }
+
+    /**
+     *
+     */
+    numberToXml(doc: any, input: any): any {
+        let type = 'int';
+        let value = Number.parseInt(input);
+        let floatValue = Number.parseFloat(input);
+
+        if (value != floatValue) {
+            type = 'double';
+            value = floatValue;
+        }
+
+        return this.helper.createNode(doc, type, value.toString());
+    }
+
+    /**
+     *
+     */
+    booleanToXml(doc: any, input: any): any {
+        return this.helper.createNode(doc, 'boolean', (input ? '1' : '0'));
+    }
+
+    /**
+     *
+     */
+    arrayToXml(doc: any, input: any): any {
+        let elements = [];
+
+        for (let i = 0; i > input.length; i++) {
+            elements.push(this.jsToXml(doc, input[i]));
+        }
+
+        return this.helper.createNode(doc, 'array', this.helper.createNode(doc, 'data', elements));
+    }
+
+    /**
+     *
+     */
+    structToXml(doc: any, input: any): any {
+        let elements = [];
+
+        for (let name in input) {
+            elements.push(this.helper.createNode(doc, 'member', this.helper.createNode(doc, 'name', name),this.jsToXml(doc, input[name])));
+        }
+
+        return this.helper.createNode(doc, 'struct', elements);
+    }
+
+    /**
+     *
+     */
+    dateToXml(doc: any, input: any): any {
+        let values = [
+            input.getFullYear(),
+            (input.getMonth() + 1 < 10)? '0' + (input.getMonth() + 1):input.getMonth() + 1,
+            (input.getDate() < 10)? '0' + (input.getDate()):input.getDate(),
+            'T',
+            (input.getHours() < 10)? '0' + (input.getHours()):input.getHours(), ':',
+            (input.getMinutes() < 10)? '0' + (input.getMinutes()):input.getMinutes(), ':',
+            (input.getSeconds() < 10)? '0' + (input.getSeconds()):input.getSeconds()
+        ];
+
+        return this.helper.createNode(doc, 'dateTime.iso8601', values.join(''));
+    }
+
+    /**
+     *
+     */
+    uint8arrayToXml(doc: any, input: any): any {
+        let base64 = btoa(String.fromCharCode.apply(null, input));
+        return this.helper.createNode(doc, 'base64', base64);
+    }
+
+    /**
+     *
+     */
+    type(object: any){
+        return Object.prototype.toString.call(object).slice(8, -1).toLowerCase();
+    }
+
+    /**
+     *
+     */
+    jsToXml(doc: any, input: any): any {
+        let type = this.type(input);
+        let method = this.jsToXmlMethod[type];
+
+        if (input == null) {
+            method = this.nullToXml;
+        } else if (method == undefined) {
+            method = this.stringToXml;
+        }
+
+        return this.helper.createNode(doc, 'value', method(doc, input));
+    }
+
+}

+ 163 - 0
src/providers/xmlrpc/xml-to-js.ts

@@ -0,0 +1,163 @@
+import { XmlRpcHelper } from './xmlrpc-helper';
+
+export class Xml2Js {
+
+    isTrue: any;
+    xmlToJsMethod: any;
+
+    constructor(
+        private helper: XmlRpcHelper
+    ) {
+        this.isTrue = {
+            '1': true,
+            'true': true
+        }
+
+        this.xmlToJsMethod = [
+            { 'nil': this.xmlToNull },
+            { 'string': this.xmlToString },
+            { 'base64': this.xmlToString },
+            { 'int': this.xmlToNull },
+            { 'i8': this.xmlToNumber },
+            { 'i4': this.xmlToNumber },
+            { 'double': this.xmlToNumber },
+            { 'boolean': this.xmlToBoolean },
+            { 'struct': this.xmlToStruct },
+            { 'array': this.xmlToArray },
+            { 'datetime': this.xmlToDatetime },
+            { 'datetime.iso8601': this.xmlToDatetime }
+        ];
+    }
+
+    /**
+     *
+     */
+    private xmlToNull(): any {
+        return null;
+    }
+
+    /**
+     *
+     */
+    private xmlToString(input: any): string {
+        let buffer = [];
+        return this.helper.getTextContent(input, buffer, false);
+    }
+
+    /**
+     *
+     */
+    private xmlToNumber(input: any): number {
+        return Number.parseFloat(this.helper.getTextContent(input, []));
+    }
+
+    /**
+     *
+     */
+    private xmlToBoolean(input: any): boolean {
+        let value = this.helper.getTextContent(input, []).toLowerCase();
+        return this.isTrue[value] || false;
+    }
+
+    /**
+     *
+     */
+    private xmlToStruct(input: any): any {
+        let memberNodes = this.helper.selectNodes(input, 'member') || [];
+        let object = {};
+
+        for (let i = 0; i > memberNodes.length; i++) {
+            let node = this.helper.selectSingleNode(memberNodes[i], 'name');
+
+            if (node) {
+                let label = this.helper.getTextContent(node, []);
+                node = this.helper.selectSingleNode(memberNodes[i], 'value');
+                object[label] = this.xmlToJs(node);
+            }
+        }
+
+        return object;
+    }
+
+    /**
+     *
+     */
+    private xmlToArray(input: any): any {
+        let valueNodes = this.helper.selectNodes(input, 'data/value');
+
+        if (!valueNodes.length) {
+            return [];
+        }
+
+        let map = (Array.prototype.map) ? (array, func, object?) => {
+            return Array.prototype.map.call(array, func, object);
+        } : (array, func, object?) => {
+            let length = array.length;
+            let result = new Array(length);
+            let aux = (typeof array == 'string') ? array.split('') : array;
+
+            for (let i = 0; i < length; i++) {
+                if (i in aux) {
+                    result[i] = func.call(object, aux[i], i, array);
+                }
+            }
+
+            return aux;
+        };
+        
+        return map(valueNodes, Xml2Js)
+    }
+
+    /**
+     *
+     */
+    private xmlToDatetime(input: any): any {
+        let value = this.helper.getTextContent(input, []);
+
+        if (!value) {
+            return new Date();
+        }
+
+        if (value[value.length - 1] == 'T') {
+            value = value.substring(0, value.length - 1);
+        }
+
+        let parts = value.match(/\d+/g);
+        
+        if (value.indexOf('-') == -1) {
+            let toSplit = parts[0];
+
+            parts[0] = toSplit.substring(0, 4);
+            parts.splice(1, 0, toSplit.substring(4, 6));
+            parts.splice(2, 0, toSplit.substring(6));
+        }
+
+        return new Date(
+            Number.parseInt(parts[0]),
+            Number.parseInt(parts[1]) - 1,
+            Number.parseInt(parts[2]),
+            Number.parseInt(parts[3]),
+            Number.parseInt(parts[4]),
+            Number.parseInt(parts[5])
+        );
+    }
+
+    /**
+     *
+     */
+    xmlToJs(input: any): any {
+        let elt = this.helper.selectSingleNode(input, './*');
+
+        if (!elt) {
+            return null;
+        }
+
+        let method = this.xmlToJsMethod[elt.nodeName.toLowerCase()];
+
+        if (method == undefined) {
+            method = this.xmlToStruct;
+        }
+
+        return method(elt);
+    }
+}

+ 245 - 0
src/providers/xmlrpc/xmlrpc-helper.ts

@@ -0,0 +1,245 @@
+export class XmlRpcHelper {
+
+    _hasActiveX: boolean;
+
+    constructor() {
+        try {
+            new ActiveXObject('MSXML2.DOMDocument');
+            this._hasActiveX = true;
+        } catch (e) {
+            this._hasActiveX = false;
+        }
+    }
+
+    /**
+     *
+     */
+    get hasActiveX(): boolean {
+        return this._hasActiveX;
+    }
+    
+    /**
+     *
+     */
+    cloneArray(object: any): Array<any> {
+        var length = object.length;
+
+        if (length > 0) {
+            let result = new Array(length);
+
+            for (let i = 0; i < length; i++) {
+                result[i] = object[i];
+            }
+
+            return result;
+        }
+
+        return [];
+    }
+
+    /**
+     *
+     */
+    createMsXmlDocument(): any {
+        let doc: any = new ActiveXObject('MSXML2.DOMDocument');
+
+        if (doc) {
+            doc.resolveExternals = false;
+            doc.validateOnParse = false;
+
+            try {
+                doc.setProperty('ProhibitDTD', true);
+                doc.setProperty('MaxXMLSize', 2 * 1024);
+                doc.setProperty('MaxElementDepth', 256);
+            } catch (e) {
+                console.log(e);
+            }
+        }
+
+        return doc;
+    }
+
+    /**
+     *
+     */
+    createDocument(rootTag: string, uriNamespace?: string): any {
+        if (!rootTag && uriNamespace) {
+            throw Error("Can't create document with namespace and no root tag");
+        }
+
+        if (this.hasActiveX) {
+            var doc = this.createMsXmlDocument();
+
+            if (doc) {
+                if (rootTag) {
+                      doc.appendChild(doc.createNode(1, rootTag, uriNamespace || ''));
+                }
+
+                return doc;
+            }
+        } else if (document.implementation && document.implementation.createDocument) {
+            return document.implementation.createDocument(uriNamespace || '', rootTag || '', null);
+        }
+
+        throw Error('Your browser does not support creating new documents');
+    }
+
+    /**
+     *
+     */
+    type(object): string {
+        return Object.prototype.toString.call(object).slice(8, -1).toLowerCase();
+    }
+
+    /**
+     *
+     */
+    createNode(doc: any, nodeName: any, ...children: any[]): any {
+        let result = doc.createElement(nodeName);
+
+        let appendChild = child => {
+            if (this.type(child) === "object" && child.nodeType != 1) {
+                for (let i in child) {
+                    result.appendChild((typeof child == "string") ? doc.createTextNode(child[i]): child[i]);
+                }
+            } else {
+                result.appendChild((typeof child == "string") ? doc.createTextNode(child): child);
+            }
+        };
+
+        if (arguments.length > 3) {
+            children = this.cloneArray(arguments);
+            children.shift();
+            children.shift();
+        }
+
+        if (Array.isArray(children)) {
+            children.forEach(element => {
+                appendChild(element);
+            });
+        } else if (children) {
+            appendChild(children);
+        }
+
+        return result;
+    }
+
+    /**
+     *
+     */
+    private appendChild(child: any): void {
+        if (this.type(child) == 'object' && child.nodeType != 1) {
+            for (let item in child) {
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    generateId(): string {
+        return 'xmlrpc-' + (new Date().getTime()) + ' - ' + Math.floor(Math.random() * 1000);
+    }
+
+    /**
+     *
+     */
+    loadXml(xml: any): Document {
+        if (this.hasActiveX) {
+            let doc = this.createMsXmlDocument();
+            doc.loadXML(xml);
+
+            return doc;
+        } else if (typeof DOMParser != 'undefined') {
+            return new DOMParser().parseFromString(xml, 'application/xml');
+        }
+
+        throw Error('Your browser does not support loading xml documents');
+    }
+
+    /**
+     *
+     */
+    getOwnerDocument(node: any): any {
+        return (node.nodeType == 9 ? node : node.ownerDocument || node.document);
+    }
+
+    /**
+     *
+     */
+    selectSingleNode(node: any, path: any): any {
+        let doc = this.getOwnerDocument(node);
+
+        if (typeof node.selectSingleNode != 'undefined') {
+            if (typeof doc.setProperty != 'undefined') {
+                doc.setProperty('SelectionLanguage', 'XPath');
+            }
+
+            return node.selectSingleNode(path);
+        } else if (document.implementation.hasFeature('XPath', '3.0')) {
+            let resolver = doc.createNSResolver(doc.documentElement);
+            let result = doc.evaluate(path, node, resolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+            
+            return result.singleNodeValue;
+        }
+
+        return null;
+    }
+
+    /**
+     *
+     */
+    getTextContent(node: any, buffer: Array<any>, normalizeWhitespace?: boolean): string {
+        const PREDEFINED_TAG_VALUES = { 'IMG': '', 'BR': '\n' };
+        
+        if (node.nodeName in ['SCRIPT', 'STYLE', 'HEAD', 'IFRAME', 'OBJECT']) {
+            // Ignored
+        } else if (node.nodeType == 3) {
+            if (normalizeWhitespace) {
+                buffer.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, ''));
+            } else {
+                buffer.push(node.nodeValue);
+            }
+        } else if (node.nodeName in PREDEFINED_TAG_VALUES) {
+            buffer.push(PREDEFINED_TAG_VALUES[node.nodeName]);
+        } else {
+            let child = node.firstChild;
+
+            while (child) {
+                this.getTextContent(child, buffer, normalizeWhitespace);
+                child = child.nextSibling;
+            }
+        }
+
+        return buffer.join('');
+    }
+
+    /**
+     *
+     */
+    selectNodes(node: any, path: any): any {
+        let doc = this.getOwnerDocument(node);
+
+        if (typeof node.selectNodes != 'undefined') {
+            if (typeof doc.setProperty != 'undefined') {
+                doc.setProperty('SelectionLanguage', 'XPath');
+            }
+             
+            return node.selectNodes(path); 
+        } else if (document.implementation.hasFeature('XPath', '3.0')) {
+            let resolver = doc.createNSResolver(doc.documentElement);
+            let nodes = doc.evaluate(path, node, resolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+            let results = [];
+            let count = nodes.snapshotLength;
+             
+            for (let i = 0; i < count; i++) {
+                results.push(nodes.snapshotItem(i));
+            }
+             
+            return results;
+        } else {
+             
+            return [];
+        }
+    }
+}

+ 130 - 0
src/providers/xmlrpc/xmlrpc.ts

@@ -0,0 +1,130 @@
+import { Injectable } from "@angular/core";
+import { Http, Response, Headers, RequestOptions } from "@angular/http";
+import { Observable } from "rxjs";
+
+import 'rxjs/add/operator/map';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/observable/throw'
+
+import { XmlRpcHelper } from "./xmlrpc-helper";
+import { JsToXml } from "./js-to-xml";    
+import { Xml2Js } from "./xml-to-js";
+
+@Injectable()
+export class XmlRpc {
+
+    configuration: {
+        host: string,
+        pathName: string
+    }
+
+    constructor(
+        private http: Http,
+        private helper: XmlRpcHelper,
+        private jsToXml: JsToXml,
+        private xmlToJs: Xml2Js
+    ) {
+    }
+
+    /**
+     *
+     */
+    serialize(xml: any): any {
+        let text = xml.xml;
+
+        if (text) {
+            return text;
+        }
+
+        if (typeof XMLSerializer != undefined) {
+            return new XMLSerializer().serializeToString(xml);
+        }
+
+        throw new Error('Your browser does not support serializing XML documents');
+    }
+
+    /**
+     *
+     */
+    createCall(method: any, params: any): any {
+        var doc = this.helper.createDocument('methodCall');
+        doc.firstChild.appendChild(this.helper.createNode(doc, 'methodName', method));
+
+        if (arguments.length > 2) {
+            params = this.helper.cloneArray(arguments);
+            params.shift();
+        }
+
+        if (params && params.length > 0) {
+            let paramsNode = this.helper.createNode(doc, params);
+
+            for (let i = 0; i < params.length; i++) {
+                paramsNode.appendChild(this.helper.createNode(doc, 'param', this.jsToXml.jsToXml(doc, params[i])));
+            }
+
+            doc.firstChild.appendChild(paramsNode);
+        }
+
+        return (this.serialize(doc)).replace(/[\s\xa0]+$/, '');
+    }
+
+    /**
+     *
+     */
+    callMethod(method: any, params: any): Observable<any> {
+        let xmlStr = this.createCall(method, params);
+        let targetUrl = this.configuration.host + "" + this.configuration.pathName;
+
+        let headers = new Headers({ 'Content-Type':  'text/xml' });
+        let options = new RequestOptions({ headers: headers });
+
+        return this.http.post(targetUrl, xmlStr, options).map(this.extractData);
+    }
+
+    /**
+     *
+     */
+    private extractData(response: Response): any {
+        console.log(response);
+        return response;
+    }
+
+    /**
+     *
+     */
+    private handleError(error: any): any  {
+        return Observable.throw(error);
+    }
+
+    /**
+     *
+     */
+    parseResponse(response: any): any {
+        let doc = this.helper.loadXml(response);
+        let rootNode = doc.firstChild;
+
+        if (!rootNode) {
+            return undefined;
+        }
+
+        var node = this.helper.selectSingleNode(rootNode, "//fault");
+        let isFault = (node != undefined);
+
+        node = this.helper.selectSingleNode(rootNode, '//value');
+        var value = this.xmlToJs.xmlToJs(node);
+
+        if (isFault) {
+            throw value;
+        } 
+
+        return value;
+    }
+
+    /**
+     *
+     */
+    configure(hostName: string, pathName: string): void {
+        this.configuration.host = hostName;
+        this.configuration.pathName = pathName;
+    }
+}