Example #1
0
    this.LatLonWifi = function(req,res,next){
       var args = {latitud: req.query.lat,longitud:req.query.lon,token: config.token};

       soap.createClient(config.serviceUrl, function(err, client) {
           client.wifi_mgp(args, function(err, result) {
               if(err || result.return.item) {
                   geoJ.return = {};
                   geoJ.success = false;
                   geoJ.error = err;
                   return res.json(404,geoJ);
               }
               geoJ.return.features = [];
                for (var i = 0; i < result.return.item.length; i++) {
                    (function(j) {
                        var feature = {
                            type: "Feature",
                            properties: {
                                descripcion: result.return.item[j].descripcion.$value,
                                codigo: result.return.item[j].codigo.$value
                            },
                            geometry: { type: "Point", coordinates: [  parseFloat(result.return.item[j].longitud.$value) ,parseFloat(result.return.item[j].latitud.$value)] }
                        };
                        geoJ.return.features.push(feature);
                     })(i);
                }
               return res.json(200,geoJ);
           });
       });
    };
Example #2
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["IdCliente"] = req.body.IdCliente;


            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }

                client.GetPurchaseOrder(args, function (err, result) {
                    
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    res.json(result.GetPurchaseOrderHistoricalResult.Data);

                });
            });
        });
Example #3
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["Email"] = req.body.Email;


            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor n.Rowso responde");
                    return;
                }



                client.SendForgetPassword(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    
                    res.json(result.SendForgetPasswordResult.Data);

                });
            });
        });
Example #4
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["IdCliente"] = req.body.IdCliente;
            args["UserName"] = req.body.UserName;
            args["UserLastName"] = req.body.UserLastName;
            args["UserGender"] = req.body.UserGender;
            args["UserBirthdate"] = req.body.UserBirthdate;
            args["IdPlataforma"] = req.body.IdPlataforma;
            args["UserEmail"] = req.body.UserEmail;
            args["UserPhone"] = req.body.UserPhone;

            soap.createClient(url, function (err, client) {

                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }



                client.UpdateInfoUserBoxIt(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    res.json(result.UpdateInfoUserBoxItResult.Data.Rows);
                    //console.log(JSON.stringify(result.UpdateInfoUserBoxItResult.Data.Rows));
                });
            });
        });
Example #5
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["IdCliente"] = req.body.IdCliente;
            args["TrackingNumber"] = req.body.TrackingNumber;
            args["Shop"] = req.body.Shop;
            args["Value"] = req.body.Value;
            args["Description"] = req.body.Description;


            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }


                client.InsertClientAlert(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    
                    res.json(result.InsertClientAlertResult);

                });
            });
        });
Example #6
0
        return new Promise(function (resolve, reject) {
            soap.createClient(WSDL, function(err, client) {
                if(err){ reject(err) }
                var endPoint = options.sandbox? SANDBOX : PRODUCTION;
                client.setEndpoint(endPoint);
                var operations = Object.keys(client.AWSMechanicalTurkRequester.AWSMechanicalTurkRequesterPort);
                var numOperations = operations.length;
                var processedOps = 0;
                var wrapper = {};

                operations.forEach(function(operation){
                    wrapClientMethods(client, wrapper, options, operation);
                    processedOps++;
                    if(processedOps === numOperations){ resolve(wrapper) }
                })

                wrapper.validOps = function(){ return operations; }
                wrapper.req = function(opName, args) {
                    return new Promise(function(resolve, reject){
                        if(wrapper[opName] && typeof wrapper[opName] == 'function') { resolve(wrapper[opName](args)); }
                        else { reject("Invalid Amazon Mechanical Turk API operation: '"+opName+"'. See the docs here: https://goo.gl/6RCpKU"); }
                    })
                };
            })
        })
exports.forwardIncident = function(action, type, ticket, next){
    var data;
    switch(type){
        case this.WALKIN:   data = formulateMessageForwarding(ticket, action);     break;
        default:    return console.error('Invalid ticket type: ' + type);
    }

    soap.createClient(credential.wsdl_url, function(err, client){
        if(err) return console.error('Client Creation Error: ' + err);
        client.setSecurity(new soap.BasicAuthSecurity(credential.username, credential.password));

        client.insert(data, function(err, response){
            if(err) return console.error('Insert Request Error: ' + err);

            if(response.sys_id && response.display_value){
                switch(response.status){
                    case 'inserted': case 'updated':
                        console.log(ticket.snValue + ' Ticket forwarded: ' + response.display_value);
                        break;
                    default:
                        console.error('Invalid Status Error:');
                        return console.error(response);
                }
            }
            else{
                console.error('Field(s) Missing Error:');
                console.error(response);
            }

            if(next) return next(ticket);
            else     return ticket;
        });
    });
};
Example #8
0
exports.calculate = function(req,res)
{
	var option = {
			ignoredNamespaces : true	
		};
	 var url = baseURL+"/Calculate?wsdl";
	var list="";
	var json_responses;
	var value="";
	var output="";
	var args = {list: req.param('list')};
	  soap.createClient(url,option, function(err, client) {
	      client.calculate(args, function(err, result) {
	    	  if(result.calculateReturn){
	    		  console.log(result.calculateReturn);
	    		  json_responses = {"statusCode" : 200,"output" : result.calculateReturn.$value};
	    		  res.send(json_responses);
	    	  }
	    	  else{
	    		  json_responses = { "statusCode" : 302};
	    		  res.send(json_responses);
	    	  }
	      });
	  });
};
Example #9
0
 Account.find(1, function(error, accounts) {
     var account = accounts[0]
     soap.createClient(url, function(err, client) {
         var request = prepareRequest(account, awb)
         callTrack(client, request, callback)
     })
 })
exports.getPic= function(req, res){






    var args = {Sessionid: req.params.sessionId,AAid: req.params.AAid};
    soap.createClient(global.urlforSoap, function (err, client) {
        //client.test(args, function(err, result) {
        console.info(args);
        client.getAABild(args, function (err, result) {


            res.jsonp(result.return);


        })



        //});
    }, global.urlforSoap2);



}
CorreiosSoapService.prototype.calculaPrazo = function (dadosEntrega, callback) {
    let url = this._urlBase + 'calculador/CalcPrecoPrazo.asmx?wsdl';

    soap.createClient(url, function(erro, cliente) {
        cliente.CalcPrazo(dadosEntrega, callback);
    });
};
exports.createPic= function(req, res){
    console.log(req.files.file.path);




        // read binary data
        var bitmap = fs.readFileSync(req.files.file.path);
        // convert binary data to base64 encoded string
        console.info(new Buffer(bitmap).toString('base64'));

    var args = {Sessionid: req.params.sessionId,AAid: req.params.AAid, Bild: new Buffer(bitmap).toString('base64')};
    soap.createClient(global.urlforSoap, function (err, client) {
        //client.test(args, function(err, result) {
        console.info(args);
        client.saveAABild(args, function (err, result) {


            res.jsonp(result.return);


        })



        //});
    }, global.urlforSoap2);



    }
Example #13
0
 return new Promise(function(fullfill, reject) {
   var soap = require('soap');
   var url = 'os_ConsCodVal.wsdl';
   soap.createClient(url, function(err, client) {
     client.setSecurity(new soap.BasicAuthSecurity('USRCP_HW', 'usrcp2012'));
     client.os_ConsCodVal({
       CodGrupos: {
         CodGrupo: 'ZPM00001'
       }
     }, function(err, datosCualitativos) {
       if (err) {
         reject({
           err:err
         });
       }
       console.log(datosCualitativos);
       fullfill(_.map(datosCualitativos.DetCodVal, function(datoCualitativo) {
         return {
           code: datoCualitativo.CODE,
           texto: datoCualitativo.KURZTEXTCD
         }
       }));
     });
   });
 });
Example #14
0
 return new Promise(function(fullfill, reject) {
   var url = 'os_ConsPtosMed.wsdl';
   soap.createClient(url, function(err, client) {
     client.setSecurity(new soap.BasicAuthSecurity('USRCP_HW', 'usrcp2012'));
     client.os_ConsPtosMed({
       Equipos: {
         Equipo: numeroEquipo
       }
     }, function(err, result) {
       if (err) {
         reject(err);
       } else {
         var puntosMedida = [];
         _.each(result.DetPtosMedida, function(puntoMedida){
           //console.log(puntoMedida);
           puntosMedida.push({
             id: puntoMedida.POINT,
             label: puntoMedida.PTTXT,
             value: puntoMedida.DECIM,
             codgr: puntoMedida.CODGR,
             unit: puntoMedida.MRNGU,
             unitDesc: puntoMedida.ATNAM
           });
         });
         fullfill(puntosMedida);
       }
     });
   });
 });
/* 
 * ITRI TTS Processing
 */
function ItriTTS(text, callback) {
  var args = {
    accountID : config.tts.itri.username,
    password : config.tts.itri.passwd,
    TTStext : text,
    TTSSpeaker : config.tts.itri.speaker,
    volume : 50,
    speed : -2,
    outType : 'wav'
  };
  soap.createClient(url, function(err, client) {
    client.ConvertText(args, function(err, result) {
      if (err) {
        log.error('err:', err);
        callback(err, null);
      }
      try {
        var id = result.Result.$value.split('&')[2];
        if (id) {
          log.debug('get id:', id);
          callback(null, id);
        } else {
          throw 'failed to convert text!';
        }
      } catch (e) {
        log.error(error);
        callback(error, null);
      }
    });
  });
}
        function loadCollections(colDef,loadCb) {
          var collectionName = colDef[0];
          var collection = colDef[1];
          collection._cast = new Deflate();
          collection._cast.initialize(collection.definition);

          collection._query = new Query(collection);

          var requestUrl = _.extend({},self.baseUrl);
          requestUrl.pathname = '/' + collectionName + '.do';
          requestUrl.query = requestUrl.query || {};
          requestUrl.query.displayvalue = 'all';

          var wsdl_headers = {
            Authorization: 'Basic ' + new Buffer(self.config.username+':'+self.config.password).toString('base64')
          };

          var urlString = url.format(requestUrl);
          collection.urlString = urlString.replace('?','?WSDL&');

          soap.createClient(collection.urlString, {wsdl_headers: wsdl_headers}, function createSOAPClient(err, client) {
            if (err) {
              loadCb(collectionName + ': ' + err);
            }
            else {
              client.setSecurity(basicAuth);
              collection.client = client;
              loadCb(err);
            }
          });
        },
function ItriGetConvertStatus(id, filename, callback) {
  var args = {
    //accountIDhasOwnProperty: config.tts.itri.username,
    accountID : config.tts.itri.username,
    password : config.tts.itri.passwd,
    convertID : id
  };
  soap.createClient(url, function(err, client) {
    log.debug('msg_id', id);
    client.GetConvertStatus(args, function(err, result) {
      if (err) {
        log.error('err:', err);
        callback(err, null);
      }
      var downloadUrl = result.Result.$value.split('&')[4];
      if (downloadUrl) {

        log.debug(id, downloadUrl);
        execSync('wget ' + downloadUrl + ' -O ' + filename, {
          stdio : [ 'ignore', 'ignore', 'ignore' ]
        });
        callback(null, filename);
      } else {
        var error = 'Still converting! result: ' + JSON.stringify(result);
        log.error(error);
        callback(error, null);
      }
    });
  });
}
exports.login=function(request,response){
	   var args = {authUser: request.body.usuario, authContrasenia: request.body.contraseƱa};
	   var resp;
	   try{
		   soap.createClient(url, function(err, client) {
		   	client.autenticacion(args, function(err, result){
		   		resp = result.autenticacionResult ;
		   		console.log(resp);
				if (resp || true ){
					db.encontrarUsuario(request.body.usuario).then(function (user){
					if(!user){
						console.log('Ud no se encuentra registrado'); //si no esta registrado lo redirecciona a index.html
						response.sendfile(html_dir + 'index.html');
					}else{			
						request.session.user=user.dataValues;
						response.redirect('/noticias');
					} }).catch(function(err){
						console.log(err);
						response.sendfile(html_dir + 'index.html');
					});
				}else{ 
					//window.alert("Ud. no es usuario Espol");
					console.log('Usuario o contraseƱa incorrecta, intente nuevamente');
					//window.alert("Ud. no es usuario Espol");
					response.sendfile(html_dir + 'index.html');
				}
		   	});
		   });
	}catch(err){
		alert('servicio web no disponible!!...');
	}
};
Example #19
0
  return new Promise((resolve, reject) => {
    const options = {
      ignoredNamespaces: {
        namespaces: [],
        override: true
      }
    };

    if (CONFIG.mock_externals && CONFIG.mock_externals.culr) {
      setMockClient();
      resolve(CulrClient);
    } else {
      soap.createClient(CONFIG.culr.uri, options, (err, client) => {
        if (err) {
          log.error('Error when creating CULR client', {error: err});
          reject(err);
          return false;
        }

        client.on('request', request => {
          log.debug('A request was made to CULR', {request: request});
        });

        client.on('response', response => {
          log.debug('A response was received from CULR', {response: response});
        });

        CulrClient = client;
        resolve(CulrClient);
      });
    }
  });
Example #20
0
function convertText(text, hash, callback) {
    var args = {
        accountID: 'richchou',
        password: '******',
        TTStext: text,
        TTSSpeaker: 'Bruce',
        volume: 50,
        speed: -2,
        outType: 'wav'
    };
    soap.createClient(url, function(err, client) {
        client.ConvertText(args, function(err, result) {
            if (err) {
                console.log('err:', err);
                callback(err, null);
            }
            try {
                var id = result.Result.$value.split('&')[2];
                if (id) {
                    console.log('get id:', id);
                    callback(null, id, hash);
                } else {
                    throw 'failed to convert text!';
                }
            } catch (e) {
                console.log(error);
                callback(error, null);
            }
        });
    });
}
Example #21
0
app.get( '/loadVariables', function( req, res ) {
    try {
        
        var dataSourceId = req.session.dataSourceId;
        if ((dataSourceId == undefined) || (isNaN(dataSourceId))) {
            return;
        }
        
        var soap = require('soap');
        var url = CONFIG.wsdl.dataExternalization;
        var args = {
            customerName: req.session.email,
            dataSourceId: parseInt(dataSourceId)
        };
        soap.createClient(url, function(err, client) {
            //console.log(client.describe());
            client.DataExternalization.DataExternalizationSOAP.getCustomerVariablesForDataSource(args, function(err, result) {
                //console.log(result);
                try {
                    res.writeHead(200, { "Content-Type" : "text/plain" });
                    res.write(JSON.stringify(result), "UTF-8");
                    res.end();
                } catch (err) {
                    console.log("WebService Warning! " + err);
                } 
            });
        });
    } catch (err) {
        console.log("WebService Warning! " + err);
    }
});
Example #22
0
function getConvertStatus(id, callback) {
    var args = {
        accountID: 'richchou',
        password: '******',
        convertID: id
    };
    soap.createClient(url, function(err, client) {
        console.log('msg_id', id);
        client.GetConvertStatus(args, function(err, result) {
            if (err) {
                console.log('err:', err);
                callback(err, null);
            }
            var downloadUrl = result.Result.$value.split('&')[4];
            if (downloadUrl) {
                //console.log('get download url: '+downloadUrl);
                console.log(id, downloadUrl);
                var wav_file = path.join(voice_path, 'text', id + '.wav');
                execSync('wget '+ downloadUrl + ' -O ' + wav_file, {stdio: [ 'ignore', 'ignore', 'ignore' ]});
                callback(null, id);
            } else {
                var error = 'Still converting! result: '+JSON.stringify(result);
                console.log(error);
                callback(error, null);
            }
        });
    });
}
Example #23
0
        .post(function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;

            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }


                client.GetTarifas(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                   
                    if (result.GetTarifasResult.Data.Rows.length === undefined) {
                        res.json(result.GetTarifasResult.Data.Rows.attributes.Message);
                    } else {
                        res.json(result.GetTarifasResult.Data.Rows);
                    }
                       // res.json(result);

                });
            });
        });
    it('should become a valid SOAP request', (done) => {
      // build the json to be sent through the SOAP service
      const result = enrollmentSystem.veteranToSaveSubmitForm(fakeApplication);
      // read in the base XSD file
      const xsdContents = fs.readFileSync('hca-api-stub/voa-voaSvc-xsd-2.xml', 'utf8');
      // we need to change directories because the xsd validator
      // loads a secondary file (voa-voaSvc-xsd-1.xml) by a path
      // relative to the process' cwd.
      process.chdir('./hca-api-stub');
      const schema = xsdValidator.parse(xsdContents);
      // reset the path
      process.chdir('../');

      // create a soap client
      soap.createClient(config.soap.wsdl, {}, (_soapError, client) => {
        // when the client sends a message, look at the body
        client.on('message', (messageBody) => {
          // validate the message body against the XSD schema
          const validationErrors = schema.validate(messageBody);
          if (validationErrors) {
            chai.assert.fail(validationErrors, null, validationErrors.join('\t'));
          }
          // tell chai that we're done
          done();
        });
        // trigger the call
        client.saveSubmitForm(result, (_submitError, _result) => {});
      });
    });
Example #25
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["IdCliente"] = req.body.IdCliente;
            args["TrackingNumber"] = req.body.TrackingNumber;

            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }



                client.GetTrackingById(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    res.json(result.GetTrackingByIdResult.Data);

                });
            });
        });
Example #26
0
    this.listInfoTuristica = function(req,res,next){
        var args = {token: config.token};

        soap.createClient(config.serviceUrl, function(err, client) {
            client.informacion_turistica(args, function(err, result) {
                if(err) {
                  geoJ.return = {};
                  geoJ.success = false;
                  geoJ.error = err;
                  return res.json(404,geoJ);
                }
                geoJ.return.features = [];
                for (var i = 0; i < result.return.item.length; i++) {
                    (function(j) {
                        var feature = {
                            type: "Feature",
                            properties: {
                                descripcion: result.return.item[j].descripcion.$value,
                                ubicacion: result.return.item[j].ubicacion.$value
                            },
                            geometry: { type: "Point", coordinates: [  parseFloat(result.return.item[j].longitud.$value) ,parseFloat(result.return.item[j].latitud.$value)] }
                        };
                        geoJ.return.features.push(feature);
                     })(i);
                }

                return res.json(200,geoJ);
            });
        });
    };
Example #27
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["IdCliente"] = req.body.IdCliente;
            //descripcion del producto
            args["Package"] = req.body.Package;
            //link al producto en amazon
            args["Link"] = req.body.Link;
            //cantidad de unidades
            args["Quantity"] = req.body.Quantity;
            //precio de la unidad
            args["Amount"] = req.body.Amount;


            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }


                client.InsertPurchaseOrder(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    
                    res.json(result.InsertPurchaseOrderResult.Data);

                });
            });
        });
Example #28
0
module.exports.send = function (message, to, callback) {

	console.log('Sending POSTAL to ' + to + '...');

	soap.createClient('https://api.postalmethods.com/2009-02-26/PostalWS.asmx?WSDL', function(err, client) {
		if (err) {
			console.log(err);
		} else {
			client.SendLetter({
				'Username': config[to].username,
				'Password': config[to].password,
				'MyDescription': message.description,
				'FileExtension': message.extension,
				'FileBinaryData': message.data,
				'WorkMode': 'Default'
			}, function(err, result) {
				if (err) {
					console.log(err);
				} else {
					console.log('POSTAL sent to ' + to);
				}
				callback();
			});
		}
	});
};
Example #29
0
        function (req, res) {
            var args = {};
            args["CustomerUser"] = CustomerUser;
            args["CustomerPassword"] = CustomerPassword;
            args["IdCliente"] = req.body.IdCliente;
            args["UserPasswordNew"] = req.body.UserPasswordNew;

            soap.createClient(url, function (err, client) {
                if (client === undefined) {
                    res.json("Servidor no responde");
                    return;
                }


                client.UpdateForgetPassword(args, function (err, result) {
                       if(result === undefined){
                    res.json("Servidor no responde");
                    return ;
                }
                    
                    res.json(result.UpdateForgetPasswordResult.Data);

                });
            });
        });
Example #30
0
    this.LatLonBarrio = function(req,res,next){
        var args = {latitud: req.query.lat,longitud:req.query.lon,token: config.token};

        soap.createClient(config.serviceUrl, function(err, client) {
            client.latlong_barrio(args, function(err, result) {
                if(err) {
                    geoJ.return = {};
                    geoJ.success = false;
                    geoJ.error = err;
                    return res.json(404,geoJ);
                }
                geoJ.return.features = [];
                var feature = {
                    type: "Feature",
                    properties: {
                      descripcion: result.return.descripcion.$value,
                      codigo: result.return.codigo.$value
                    },
                    geometry: { type: "Point", coordinates: [  parseFloat(req.query.lon) ,parseFloat(req.query.lat)] }
                };
                geoJ.return.features.push(feature);

                return res.json(200,geoJ);
            });
        });
    };