WSL/SLF GitLab Repository

Commit d70a301f authored by Thomas Egger's avatar Thomas Egger
Browse files

GSNIO is now capable of accepting a user specified web service endpoint....

GSNIO is now capable of accepting a user specified web service endpoint. Simply add the ENDPOINT key to your io.ini and set it to the correct location, e.g. http://197.43.210.10:22221/services/A3DWebService/

ENDPOINT = http://197.43.210.10:22221/services/A3DWebService/
parent 1df899b9
......@@ -48,14 +48,14 @@ const resamplingptr& ResamplingAlgorithms::getAlgorithm(const std::string& algon
it = algorithmMap.find(algoname);
if (it==algorithmMap.end())
throw UnknownValueException("Unknown resamplng algorithm called: " + algoname, AT);
throw UnknownValueException("Unknown resampling algorithm called: " + algoname, AT);
return it->second;
}
/******************************************************************************
/**********************************************************************************
* The following functions are implementations of different resampling algorithms *
******************************************************************************/
**********************************************************************************/
/**
* @brief Nearest Neighbour data resampling: Find the nearest neighbour of a desired data point
......
......@@ -51,6 +51,7 @@ namespace mio {
* - COORDPARAM: extra input coordinates parameters (see Coords) specified in the [Input] section
* - COORDSYS: output coordinate system (see Coords) specified in the [Output] section
* - COORDPARAM: extra output coordinates parameters (see Coords) specified in the [Output] section
* - ENDPOINT: The URL of the web service e.g. http://192.33.210.10:22201/services/A3DWebService/
* - PROXY: an IP address or a resolveable hostname
* - PROXYPORT: the port the proxy is listening on
* - PROXYUSER: (if necessary) a proxy username
......@@ -86,12 +87,17 @@ GSNIO::GSNIO(const ConfigReader& cfgreader) : IOInterface(NULL), cfg(cfgreader)
GSNIO::~GSNIO() throw(){}
void GSNIO::initGSNConnection(){
hostname = port = userid = passwd="";
endpoint = hostname = port = userid = passwd = "";
proxyport = -1;
//soap_init(&gsn);
//soap_init2(&gsn, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE);
cfg.getValue("ENDPOINT", "INPUT", endpoint, ConfigReader::nothrow);
if (endpoint != ""){
gsn.soap_endpoint = endpoint.c_str();
cout << "\tUsing GSN Endpoint: " << endpoint << endl;
}
/*
* Trying to read proxy settings:
* - Firstly the hostname and port (both have to be provided).
......@@ -99,9 +105,9 @@ void GSNIO::initGSNConnection(){
* - parameters not set will be set to ""
*/
try {
cfg.getValue("PROXY", hostname, ConfigReader::nothrow);
cfg.getValue("PROXY", "INPUT", hostname, ConfigReader::nothrow);
if (hostname == "") return;
cfg.getValue("PROXYPORT", port, ConfigReader::nothrow);
cfg.getValue("PROXYPORT", "INPUT", port, ConfigReader::nothrow);
if (port == "") return;
if (!IOUtils::convertString(proxyport, port, std::dec))
......@@ -112,9 +118,9 @@ void GSNIO::initGSNConnection(){
gsn.proxy_host = hostname.c_str();
gsn.proxy_port = proxyport;
cfg.getValue("PROXYUSER", userid);
cfg.getValue("PROXYUSER", "INPUT", userid);
gsn.proxy_userid = userid.c_str();
cfg.getValue("PROXYPASS", passwd);
cfg.getValue("PROXYPASS", "INPUT", passwd);
gsn.proxy_passwd = passwd.c_str();
} catch(...){}
}
......
......@@ -81,7 +81,7 @@ class GSNIO : public IOInterface {
A3DWebServiceSoap12BindingProxy gsn;
ConfigReader cfg;
std::vector<std::string> vecStationName;
std::string hostname, port, userid, passwd; ///< Variables for proxy configuration
std::string endpoint, hostname, port, userid, passwd; ///< Variables for proxy configuration
int proxyport; ///< Variable for proxy configuration
static const double plugin_nodata; //plugin specific nodata value, e.g. -999
std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
......
......@@ -3,7 +3,7 @@ if(COMMAND cmake_policy)
endif(COMMAND cmake_policy)
IF(GSNIO)
IF(PLUGIN_GSNIO)
find_program(WSDL2H wsdl2h)
find_program(SOAPCPP2 soapcpp2)
find_library(GSOAPPP gsoap++)
......@@ -17,12 +17,12 @@ IF(GSNIO)
SET_SOURCE_FILES_PROPERTIES(soapC.cpp PROPERTIES GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES(soapA3DWebServiceSoap12BindingProxy.cpp PROPERTIES GENERATED TRUE)
add_executable(gsnclient gsnclient.cc soapA3DWebServiceSoap12BindingProxy.cpp soapC.cpp)
#add_executable(gsnclient gsnclient.cc soapA3DWebServiceSoap12BindingProxy.cpp soapC.cpp)
target_link_libraries(gsnclient ${GSOAPPP} stdc++)
add_dependencies(gsnclient wsdl2cpp)
#target_link_libraries(gsnclient ${GSOAPPP} stdc++)
#add_dependencies(gsnclient wsdl2cpp)
ENDIF(GSNIO)
ENDIF(PLUGIN_GSNIO)
SET_DIRECTORY_PROPERTIES(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES "*~;soap*;*.nsmap;gsnclient;A3DWebService.h")
......@@ -4,6 +4,7 @@
#include <iostream>
#include <sstream>
#include <ctime>
#include <string.h>
using namespace std;
......@@ -20,6 +21,8 @@ int main(){
//_ns1__getSensorInfoResponse sensorinfo;
gsn.soap_endpoint = "http://192.33.210.20:22001/services/A3DWebService/";
/*
gsn.proxy_host = "77.244.247.232"; // IP or domain
gsn.proxy_port = 3128;
......@@ -49,6 +52,7 @@ int main(){
cout << "TEST Webservice" << endl;
//if (soap_call___ns2__getSensors(&gsn, "", "", &sensors) == SOAP_OK){
if (gsn.getSensors(&sensors) == SOAP_OK){
cout << "Number of sensors accessible thorugh GSN: " << sensors.return_.size() << endl;
for (unsigned int ii=0; ii<sensors.return_.size(); ii++){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment