Public Member Functions | Static Public Member Functions | List of all members
WSUtil Class Reference

Used by OSSolverAgent client for help in invoking a remote solver.. More...

#include <OSWSUtil.h>

Public Member Functions

 WSUtil ()
 Default constructor. More...
 
 ~WSUtil ()
 Class destructor. More...
 

Static Public Member Functions

static std::string sendSOAPMessage (std::string theSOAP, std::string serviceIP, unsigned int servicePortNumber)
 open a socket and send a SOAP message to the solver Web Service More...
 
static std::string SOAPify (std::string theXmlString, bool useCDATA)
 prepare XML to be put into a SOAP envelop, replace < with < replace > with > replace " and ' with More...
 
static std::string deSOAPify (std::string theXmlString, bool useCDATA)
 take the XML from a SOAP envelop and replace < with < replace > with > replace &quot with "; More...
 
static std::string createSOAPMessage (int numInputs, std::string solverAddress, std::string postURI, std::string smethod, std::string *msInputs, std::string *msInputNames, std::string sSoapAction)
 create the SOAP message that is send to the solver Web Service More...
 
static std::string createFormDataUpload (std::string solverAddress, std::string postURI, std::string fileName, std::string theFile, std::string boundaryName)
 create the SOAP message that is sent to the solver Web Service More...
 
static std::string getOSxL (std::string soapstring, std::string serviceMethod)
 extract the appropriate OSxL protocol from the SOAP envelop More...
 

Detailed Description

Used by OSSolverAgent client for help in invoking a remote solver..

Remarks

The following key utilities invoked:

  1. Open a TCP socket and send a message
  2. Modify XML to use in a SOAP message
  3. Modify the result of a SOAP message to be valid XML
  4. Extract an OSxL from the SOAP

Definition at line 42 of file OSWSUtil.h.

Constructor & Destructor Documentation

WSUtil::WSUtil ( )

Default constructor.

Parameters
solverURIis the location of remote solver or scheduler

Definition at line 55 of file OSWSUtil.cpp.

WSUtil::~WSUtil ( )

Class destructor.

Definition at line 59 of file OSWSUtil.cpp.

Member Function Documentation

string WSUtil::sendSOAPMessage ( std::string  theSOAP,
std::string  serviceIP,
unsigned int  servicePortNumber 
)
static

open a socket and send a SOAP message to the solver Web Service

Parameters
theSOAPis a string that SOAP message sent to the Web service
servIPis a string with IP address or domain name of the server
solverPortNumberis a string with the port number of Web server (assume 80 by default)
Returns
the reply from the Web service in a SOAP message.

Definition at line 65 of file OSWSUtil.cpp.

string WSUtil::SOAPify ( std::string  theXmlString,
bool  useCDATA 
)
static

prepare XML to be put into a SOAP envelop, replace < with < replace > with > replace " and ' with

Parameters
theXmlStringis the string to modify to out in the SOAP envelop
useCDATAis true if just encase the XML in a CDATA statement
Returns
the XML string that goes into the SOAP envelop.

replace all occurrences of "<" with "&lt;" all occurrences of ">" with "&gt;" and all occurrences of " or ' with

Definition at line 247 of file OSWSUtil.cpp.

string WSUtil::deSOAPify ( std::string  theXmlString,
bool  useCDATA 
)
static

take the XML from a SOAP envelop and replace < with < replace > with > replace &quot with ";

Parameters
theXmlStringis the string from the SOAP envelop to modify
useCDATAis true if just encasing the XML in a CDATA statement
Returns
the resulting XML string.

replace all occurrences of "&lt;" with "<", all occurrences of "&gt;" with ">" and all occurrences of "&quote;" with "

Definition at line 292 of file OSWSUtil.cpp.

std::string WSUtil::createSOAPMessage ( int  numInputs,
std::string  solverAddress,
std::string  postURI,
std::string  smethod,
std::string *  msInputs,
std::string *  msInputNames,
std::string  sSoapAction 
)
static

create the SOAP message that is send to the solver Web Service

Parameters
numInputsis the number of OSxL protocols (e.g. osil, osol) in the SOAP message
solverAddressis the address of the scheduler or solver used
postURIis the path to the solver that follows the first / in the solverAddress
smethodis the method invoked, e.g. solve, kill, send, etc.
msInputsis string pointer to an array of strings are the OSxL protocols protocols that go into the message, e.g. osil, osol
msInputNamesis a string pointer to an array of string names of the OSxL protocols
sSoapActionis the name of the solver service plus the method, e.g. OSSolverService::solve
Returns
the resulting XML string that is the SOAP message.

Definition at line 155 of file OSWSUtil.cpp.

std::string WSUtil::createFormDataUpload ( std::string  solverAddress,
std::string  postURI,
std::string  fileName,
std::string  theFile,
std::string  boundaryName 
)
static

create the SOAP message that is sent to the solver Web Service

Parameters
numInputsis the number of OSxL protocols (e.g. osil, osol) in the SOAP message
solverAddressis the address of the scheduler or solver used
postURIis the path to the solver that follows the first / in the solverAddress
smethodis the method invoked, e.g. solve, kill, send, etc.
msInputsis string pointer to an array of strings are the OSxL protocols protocols that go into the message, e.g. osil, osol
msInputNamesis string pointer to an array of string names of the OSxL protocols
sSoapActionis the name of the solver service plus the method, e.g. OSSolverService::solve
Returns
the resulting XML string that is the SOAP message.

Definition at line 200 of file OSWSUtil.cpp.

string WSUtil::getOSxL ( std::string  soapstring,
std::string  serviceMethod 
)
static

extract the appropriate OSxL protocol from the SOAP envelop

Parameters
soapstringthe soap envelop returned from the Web service
serviceMethod– extract the string between the <serviceMethodReturn> and </serviceMethodReturn> tags.
Returns
the resulting protocol.

get the string that starts with <osxl inside the soap envelope

Definition at line 374 of file OSWSUtil.cpp.


The documentation for this class was generated from the following files: