Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
Arc::ClientSOAP Class Reference

Class with easy interface for sending/receiving SOAP messages over HTTP(S/G). More...

#include <ClientInterface.h>

Inheritance diagram for Arc::ClientSOAP:
Inheritance graph
[legend]
Collaboration diagram for Arc::ClientSOAP:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ClientSOAP ()
 Constructor creates MCC chain and connects to server.
 ClientSOAP (const BaseConfig &cfg, const URL &url, int timeout=-1)
virtual ~ClientSOAP ()
MCC_Status process (PayloadSOAP *request, PayloadSOAP **response)
 Send SOAP request and receive response.
MCC_Status process (const std::string &action, PayloadSOAP *request, PayloadSOAP **response)
 Send SOAP request with specified SOAP action and receive response.
MCCGetEntry ()
 Returns entry point to SOAP MCC in configured chain.
void AddSecHandler (XMLNode handlercfg, const std::string &libanme="", const std::string &libpath="")
 Adds security handler to configuration of SOAP MCC.
virtual bool Load ()
 Instantiates pluggable elements according to generated configuration.
MCC_Status process (const std::string &method, PayloadRawInterface *request, HTTPClientInfo *info, PayloadRawInterface **response)
MCC_Status process (const std::string &method, std::multimap< std::string, std::string > &attributes, PayloadRawInterface *request, HTTPClientInfo *info, PayloadRawInterface **response)
MCC_Status process (const std::string &method, const std::string &path, PayloadRawInterface *request, HTTPClientInfo *info, PayloadRawInterface **response)
MCC_Status process (const std::string &method, const std::string &path, std::multimap< std::string, std::string > &attributes, PayloadRawInterface *request, HTTPClientInfo *info, PayloadRawInterface **response)
MCC_Status process (const std::string &method, const std::string &path, uint64_t range_start, uint64_t range_end, PayloadRawInterface *request, HTTPClientInfo *info, PayloadRawInterface **response)
MCC_Status process (const std::string &method, const std::string &path, std::multimap< std::string, std::string > &attributes, uint64_t range_start, uint64_t range_end, PayloadRawInterface *request, HTTPClientInfo *info, PayloadRawInterface **response)
MCC_Status process (PayloadRawInterface *request, PayloadStreamInterface **response, bool tls)
void AddSecHandler (XMLNode handlercfg, SecurityLayer sec, const std::string &libanme="", const std::string &libpath="")
void RelativeURI (bool val)
void Overlay (XMLNode cfg)
const ConfigGetConfig () const
MessageContextGetContext ()

Static Protected Member Functions

static void AddSecHandler (XMLNode mcccfg, XMLNode handlercfg)
static void AddPlugin (XMLNode mcccfg, const std::string &libname, const std::string &libpath="")

Protected Attributes

MCCsoap_entry
MCChttp_entry
URL default_url
bool relative_uri
SecurityLayer sec
MCCtcp_entry
MCCtls_entry
Config xmlcfg
XMLNode overlay
MCCLoaderloader
MessageContext context

Static Protected Attributes

static Logger logger

Detailed Description

Class with easy interface for sending/receiving SOAP messages over HTTP(S/G).

It takes care of configuring MCC chain and making an entry point.

Definition at line 146 of file ClientInterface.h.


Constructor & Destructor Documentation

Constructor creates MCC chain and connects to server.

Definition at line 150 of file ClientInterface.h.

      : soap_entry(NULL) {}
Arc::ClientSOAP::ClientSOAP ( const BaseConfig cfg,
const URL url,
int  timeout = -1 
)

Definition at line 441 of file ClientInterface.cpp.

    : ClientHTTP(cfg, url, timeout),
      soap_entry(NULL) {
    XMLNode comp =
      ConfigMakeComponent(xmlcfg["Chain"], "soap.client", "soap", "http");
    comp.NewAttribute("entry") = "soap";
  }

Here is the call graph for this function:

Definition at line 449 of file ClientInterface.cpp.

{}

Member Function Documentation

void Arc::ClientInterface::AddPlugin ( XMLNode  mcccfg,
const std::string &  libname,
const std::string &  libpath = "" 
) [static, protected, inherited]

Definition at line 107 of file ClientInterface.cpp.

                                                                                                    {
    if (!libpath.empty()) {
      XMLNode mm = mcccfg["ModuleManager"];
      if (!mm)
        mcccfg.NewChild("ModuleManager", 0);
      XMLNode mp = mm["Path"];
      for (; (bool)mp; ++mp)
        if (mp == libpath)
          break;
      if (!mp)
        mm.NewChild("Path") = libpath;
    }
    if (!libname.empty()) {
      XMLNode pl = mcccfg["Plugins"];
      for (; (bool)pl; ++pl)
        if (pl["Name"] == libname)
          break;
      if (!pl)
        mcccfg.NewChild("Plugins", 0).NewChild("Name") = libname;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::ClientInterface::AddSecHandler ( XMLNode  mcccfg,
XMLNode  handlercfg 
) [static, protected, inherited]

Definition at line 101 of file ClientInterface.cpp.

                                                                        {
    // Insert SecHandler configuration into MCC configuration block
    // Make sure namespaces and names are correct
    mcccfg.NewChild(handlercfg).Name("SecHandler");
  }

Here is the call graph for this function:

void Arc::ClientTCP::AddSecHandler ( XMLNode  handlercfg,
SecurityLayer  sec,
const std::string &  libanme = "",
const std::string &  libpath = "" 
) [inherited]

Definition at line 223 of file ClientInterface.cpp.

                                                                                                                         {
    if (sec == TLSSec)
      ClientInterface::AddSecHandler(
        ConfigFindComponent(xmlcfg["Chain"], "tls.client", "tls"),
        handlercfg);
    else if (sec == GSISec)
      ClientInterface::AddSecHandler(
        ConfigFindComponent(xmlcfg["Chain"], "gsi.client", "gsi"),
        handlercfg);
    else
      ClientInterface::AddSecHandler(
        ConfigFindComponent(xmlcfg["Chain"], "tcp.client", "tcp"),
        handlercfg);
    for (XMLNode pl = handlercfg["Plugins"]; (bool)pl; ++pl)
      AddPlugin(xmlcfg, pl["Name"]);
    AddPlugin(xmlcfg, libname, libpath);
  }

Here is the call graph for this function:

void Arc::ClientSOAP::AddSecHandler ( XMLNode  handlercfg,
const std::string &  libanme = "",
const std::string &  libpath = "" 
)

Adds security handler to configuration of SOAP MCC.

Reimplemented from Arc::ClientHTTP.

Definition at line 493 of file ClientInterface.cpp.

                                                                                                       {
    ClientInterface::AddSecHandler(
      ConfigFindComponent(xmlcfg["Chain"], "soap.client", "soap"),
      handlercfg);
    for (XMLNode pl = handlercfg["Plugins"]; (bool)pl; ++pl)
      AddPlugin(xmlcfg, pl["Name"]);
    AddPlugin(xmlcfg, libname, libpath);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const Config& Arc::ClientInterface::GetConfig ( ) const [inline, inherited]

Definition at line 39 of file ClientInterface.h.

                                    {
      return xmlcfg;
    }

Here is the caller graph for this function:

Definition at line 42 of file ClientInterface.h.

                                 {
      return context;
    }

Here is the caller graph for this function:

Returns entry point to SOAP MCC in configured chain.

To initialize entry point Load() method must be called.

Reimplemented from Arc::ClientHTTP.

Definition at line 161 of file ClientInterface.h.

                    {
      return soap_entry;
    }

Here is the caller graph for this function:

bool Arc::ClientSOAP::Load ( ) [virtual]

Instantiates pluggable elements according to generated configuration.

Reimplemented from Arc::ClientHTTP.

Definition at line 456 of file ClientInterface.cpp.

                        {
    if(!ClientHTTP::Load()) return false;
    if (!soap_entry)
      soap_entry = (*loader)["soap"];
    if (!soap_entry) return false;
    return true;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::ClientInterface::Overlay ( XMLNode  cfg) [inherited]

Definition at line 97 of file ClientInterface.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

MCC_Status Arc::ClientTCP::process ( PayloadRawInterface request,
PayloadStreamInterface **  response,
bool  tls 
) [inherited]

Definition at line 188 of file ClientInterface.cpp.

                                                                             {
    *response = NULL;
    if (!Load())
      return MCC_Status();
    if (tls && !tls_entry)
      return MCC_Status();
    if (!tls && !tcp_entry)
      return MCC_Status();
    MessageAttributes attributes_req;
    MessageAttributes attributes_rep;
    Message reqmsg;
    Message repmsg;
    reqmsg.Attributes(&attributes_req);
    reqmsg.Context(&context);
    reqmsg.Payload(request);
    repmsg.Attributes(&attributes_rep);
    repmsg.Context(&context);

    MCC_Status r;
    if (tls)
      r = tls_entry->process(reqmsg, repmsg);
    else
      r = tcp_entry->process(reqmsg, repmsg);

    if (repmsg.Payload() != NULL)
      try {
        *response =
          dynamic_cast<PayloadStreamInterface*>(repmsg.Payload());
      } catch (std::exception&) {
        delete repmsg.Payload();
      }
    return r;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

MCC_Status Arc::ClientHTTP::process ( const std::string &  method,
PayloadRawInterface request,
HTTPClientInfo info,
PayloadRawInterface **  response 
) [inherited]

Definition at line 309 of file ClientInterface.cpp.

                                                                 {
    std::multimap<std::string, std::string> attributes;
    return process(method, "", attributes, 0, UINT64_MAX, request, info, response);
  }

Here is the caller graph for this function:

MCC_Status Arc::ClientHTTP::process ( const std::string &  method,
std::multimap< std::string, std::string > &  attributes,
PayloadRawInterface request,
HTTPClientInfo info,
PayloadRawInterface **  response 
) [inherited]

Definition at line 317 of file ClientInterface.cpp.

                                                         {
    return process(method, "", attributes, 0, UINT64_MAX, request, info, response);
  }

Here is the call graph for this function:

MCC_Status Arc::ClientHTTP::process ( const std::string &  method,
const std::string &  path,
PayloadRawInterface request,
HTTPClientInfo info,
PayloadRawInterface **  response 
) [inherited]

Definition at line 325 of file ClientInterface.cpp.

                                                                 {
    std::multimap<std::string, std::string> attributes;
    return process(method, path, attributes, 0, UINT64_MAX, request, info, response);
  }

Here is the call graph for this function:

MCC_Status Arc::ClientHTTP::process ( const std::string &  method,
const std::string &  path,
std::multimap< std::string, std::string > &  attributes,
PayloadRawInterface request,
HTTPClientInfo info,
PayloadRawInterface **  response 
) [inherited]

Definition at line 334 of file ClientInterface.cpp.

                                                         {
    return process(method, path, attributes, 0, UINT64_MAX, request, info, response);
  }

Here is the call graph for this function:

MCC_Status Arc::ClientHTTP::process ( const std::string &  method,
const std::string &  path,
uint64_t  range_start,
uint64_t  range_end,
PayloadRawInterface request,
HTTPClientInfo info,
PayloadRawInterface **  response 
) [inherited]

Definition at line 343 of file ClientInterface.cpp.

                                                                 {
    std::multimap<std::string, std::string> attributes;
    return process(method, path, attributes, range_start, range_end, request, info, response);
  }

Here is the call graph for this function:

MCC_Status Arc::ClientHTTP::process ( const std::string &  method,
const std::string &  path,
std::multimap< std::string, std::string > &  attributes,
uint64_t  range_start,
uint64_t  range_end,
PayloadRawInterface request,
HTTPClientInfo info,
PayloadRawInterface **  response 
) [inherited]

Definition at line 353 of file ClientInterface.cpp.

                                                         {
    *response = NULL;
    if (!Load())
      return MCC_Status();
    if (!http_entry)
      return MCC_Status();
    MessageAttributes attributes_req;
    MessageAttributes attributes_rep;
    Message reqmsg;
    Message repmsg;
    reqmsg.Attributes(&attributes_req);
    reqmsg.Context(&context);
    reqmsg.Payload(request);
    repmsg.Attributes(&attributes_rep);
    repmsg.Context(&context);
    reqmsg.Attributes()->set("HTTP:METHOD", method);
    if (!path.empty()) {
      URL url(default_url);
      url.ChangePath(path);
      if(relative_uri) {
        // Workaround for servers which can't handle full URLs in request
        reqmsg.Attributes()->set("HTTP:HOST", url.Host() + ":" + tostring(url.Port()));
        std::string rpath = url.FullPath();
        if(rpath[0] != '/') rpath.insert(0,"/");
        reqmsg.Attributes()->set("HTTP:ENDPOINT", rpath);
      } else {
        reqmsg.Attributes()->set("HTTP:ENDPOINT", url.str());
      }
    } else {
      if(relative_uri) {
        reqmsg.Attributes()->set("HTTP:HOST", default_url.Host() + ":" + tostring(default_url.Port()));
        std::string rpath = default_url.FullPath();
        if(rpath[0] != '/') rpath.insert(0,"/");
        reqmsg.Attributes()->set("HTTP:ENDPOINT", rpath);
      }
    }
    if (range_end != UINT64_MAX)
      reqmsg.Attributes()->set("HTTP:Range", "bytes=" + tostring(range_start) +
                               "-" + tostring(range_end));
    else if (range_start != 0)
      reqmsg.Attributes()->set("HTTP:Range", "bytes=" +
                               tostring(range_start) + "-");
    std::map<std::string, std::string>::iterator it;
    for (it = attributes.begin(); it != attributes.end(); it++) {
      std::string key("HTTP:");
      key.append((*it).first);
      reqmsg.Attributes()->add(key, (*it).second);
    }
    MCC_Status r = http_entry->process(reqmsg, repmsg);
    if(!r) {
      if (repmsg.Payload() != NULL) delete repmsg.Payload();
      return r;
    };
    stringto(repmsg.Attributes()->get("HTTP:CODE"),info->code);
    info->reason = repmsg.Attributes()->get("HTTP:REASON");
    stringto(repmsg.Attributes()->get("HTTP:content-length"),info->size);
    std::string lm;
    lm = repmsg.Attributes()->get("HTTP:last-modified");
    if (lm.size() > 11)
      info->lastModified = lm;
    info->type = repmsg.Attributes()->get("HTTP:content-type");
    for(AttributeIterator i = repmsg.Attributes()->getAll("HTTP:set-cookie");
        i.hasMore();++i) info->cookies.push_back(*i);
    info->location = repmsg.Attributes()->get("HTTP:location");
    if (repmsg.Payload() != NULL)
      try {
        *response = dynamic_cast<PayloadRawInterface*>(repmsg.Payload());
      } catch (std::exception&) {
        delete repmsg.Payload();
      }
    return r;
  }

Here is the call graph for this function:

MCC_Status Arc::ClientSOAP::process ( PayloadSOAP request,
PayloadSOAP **  response 
)

Send SOAP request and receive response.

Definition at line 451 of file ClientInterface.cpp.

                                                         {
    return process("", request, response);
  }

Here is the caller graph for this function:

MCC_Status Arc::ClientSOAP::process ( const std::string &  action,
PayloadSOAP request,
PayloadSOAP **  response 
)

Send SOAP request with specified SOAP action and receive response.

Definition at line 464 of file ClientInterface.cpp.

                                                         {
    *response = NULL;
    if(!Load())
      return MCC_Status();
    if (!soap_entry)
      return MCC_Status();
    MessageAttributes attributes_req;
    MessageAttributes attributes_rep;
    Message reqmsg;
    Message repmsg;
    reqmsg.Attributes(&attributes_req);
    reqmsg.Context(&context);
    reqmsg.Payload(request);
    repmsg.Attributes(&attributes_rep);
    repmsg.Context(&context);
    if (!action.empty())
      attributes_req.set("SOAP:ACTION", action);
    MCC_Status r = soap_entry->process(reqmsg, repmsg);
    if (repmsg.Payload() != NULL)
      try {
        *response = dynamic_cast<PayloadSOAP*>(repmsg.Payload());
      } catch (std::exception&) {
        delete repmsg.Payload();
      }
    return r;
  }

Here is the call graph for this function:

void Arc::ClientHTTP::RelativeURI ( bool  val) [inline, inherited]

Definition at line 135 of file ClientInterface.h.

{ relative_uri=val; };

Member Data Documentation

Definition at line 50 of file ClientInterface.h.

URL Arc::ClientHTTP::default_url [protected, inherited]

Definition at line 138 of file ClientInterface.h.

MCC* Arc::ClientHTTP::http_entry [protected, inherited]

Definition at line 135 of file ClientInterface.h.

MCCLoader* Arc::ClientInterface::loader [protected, inherited]

Definition at line 49 of file ClientInterface.h.

Logger Arc::ClientInterface::logger [static, protected, inherited]

Definition at line 51 of file ClientInterface.h.

XMLNode Arc::ClientInterface::overlay [protected, inherited]

Definition at line 48 of file ClientInterface.h.

bool Arc::ClientHTTP::relative_uri [protected, inherited]

Definition at line 139 of file ClientInterface.h.

SecurityLayer Arc::ClientHTTP::sec [protected, inherited]

Definition at line 140 of file ClientInterface.h.

Definition at line 169 of file ClientInterface.h.

MCC* Arc::ClientTCP::tcp_entry [protected, inherited]

Definition at line 83 of file ClientInterface.h.

MCC* Arc::ClientTCP::tls_entry [protected, inherited]

Definition at line 84 of file ClientInterface.h.

Config Arc::ClientInterface::xmlcfg [protected, inherited]

Definition at line 47 of file ClientInterface.h.


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