genSOAPClientInterface         package:SSOAP         R Documentation

_C_r_e_a_t_e _R _f_u_n_c_t_i_o_n_s _t_o _a_c_c_e_s_s _S_O_A_P _s_e_r_v_e_r _m_e_t_h_o_d_s

_D_e_s_c_r_i_p_t_i_o_n:

     This function creates function definitions, etc. that provide
     access to the methods described in the SOAP server description
     details.

_U_s_a_g_e:

     genSOAPClientInterface(operations = def@operations[[1]], def, name = def@name,
                            env = new.env(parent = globalenv()), where = globalenv(),
                            server = def@server, nameSpaces = def@nameSpaces, 
                            addSoapHeader = FALSE, verbose = FALSE, force = FALSE)

_A_r_g_u_m_e_n_t_s:

operations: a list of the descriptions of the server's methods. Each
          method description  provides information about the parameters
          and the return value.

     def: the 'SOAPServerDescription-class' object.

    name: currently unused 

     env: an environment object.  This is used ?

   where: the location (usually in the search path) where new S4
          classes will  be defined to represent the complex return
          types.  This can be any value that is acceptable for the
          'where' argument of 'setClass', i.e.  an integer, a package
          name (package:name) or, explicitly, an environment.  

  server: an object which will be used as the server in the SOAP calls.
          This provides the user with a mechanism to provide an
          alternative server object such as one which contains a
          password or which already has a connection to the SOAP
          server, or controls the connection in different ways. 

nameSpaces: a character vector that identifies the namespace-URI
          mappings used for calls to this server. This maps the
          namespace abbreviations to the actual URIs. This can be a
          named character vector of these mappings, or alternatively a
          simple character string that identifies the name of the
          element in the '.SOAPDefaultNameSpaces' list. And if we don't
          know the collection of namespaces, we use 'NA' to indicate
          that we shall determine this later.

addSoapHeader: controls whether a '.soapHeader' parameter is added to
          each function that is generated for the SOAP server. If this
          is a logical, 'TRUE' indicates to add the '.soapHeader'
          parameter; 'FALSE' indicates it is omitted. If this is not a
          logical value, it is taken as the value to be supplied as the
          default value for the '.soapHeader' parameter in each
          generated function. 

 verbose: a logical indicating whether information about the processing
          should be displayed on the console, as it occurs.

   force: a logical value that controls how we handle the case where we
          would define an S4 class corresponding to a data type in the
          schema but for which there already exists a class of that
          name (within the  environment in which we are defining the
          schema-related classes). 'TRUE' means that we will overwrite
          the existing class definition; 'FALSE' means to leave the
          existing class definition. This is useful when we run the
          interface generation code a second time and so have existing
          class defintions from the first run. 

_A_u_t_h_o_r(_s):

     Duncan Temple Lang <duncan@wald.ucdavis.edu>

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.w3.org/TR/SOAP/> <URL:
     http://www.omegahat.org/SSOAP>, <URL:
     http://www.omegahat.org/bugs>.

_S_e_e _A_l_s_o:

     'processWSDL'

_E_x_a_m_p_l_e_s:

      kegg = processWSDL("http://soap.genome.jp/KEGG.wsdl")
        # note that we force the use of the 1.1 name spaces to get arrays
        # handled correctly on the server side.
      iface = genSOAPClientInterface(def = kegg, nameSpaces = "1.1")

     ## Not run: 
         # This KEGG.wsdl is out of date
      tmp = processWSDL(system.file("examples", "KEGG.wsdl", package = "SSOAP"))
      iface = genSOAPClientInterface(tmp@operations[[1]], def = tmp, tmp@name, verbose=FALSE)
     ## End(Not run)

      setAs("Definition", "character",
              function(from) 
                  structure(from@entry_id, names = from@definition))

      setAs("ArrayOfPathwayElement", "character", 
               function(from) sapply(from, as, "character"))

      o = iface@functions$list_organisms()

      as(o, "character")

      cat("See the file", system.file("examples", "KEGG.S", package = "SSOAP"), "for more examples\n")

          # Returns National Weather Service digital weather forecast data. 
       w = processWSDL("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl")
       f = genSOAPClientInterface(,w)

         # For the next 5 days from now.
       str = f@functions$NDFDgenByDay(38.9936, -77.0224, Sys.time() + 60*24*60, 5, "12 hourly")

       xmlToList(xmlParse(str, asText = TRUE))

          # Note that the result is a string containing XML. The WSDL identifies the result
          # as an xsd:string and does not tell us about the structure of the contents.

          ##
          ## WABI
     if(FALSE) {
          # This site was not available May 4th.
       w = processWSDL("http://xml.nig.ac.jp/wsdl/ARSA.wsdl")
       f = genSOAPClientInterface(,w )

       f@functions$searchSimple("Homo sapiens", 1, 100)
       x = f@functions$getENTRYbySPECIMEN("ATCC 43049", 1, 100)
       x = f@functions$getENTRYbyScientificName("Escherichia coli", 1, 400)
       els = readLines(textConnection(x))
          # get how many results are available in the database.
       totalCount = as.integer(substring(els[1], nchar("hitscount       = ")+1))
       hits = els[-1]  # the 400 results in the answer

       x = f@functions$searchByXMLPath("/ENTRY/DDBJ/accessions/accn='ab0001'", 
                                       "/ENTRY/DDBJ/primary-accession,/ENTRY/DDBJ/definition", 
                                       1, 100)
       els = unlist(strsplit(x, "\\n"))
       totalCount = as.integer(substring(els[1], nchar("hitscount       = ")+1))

       values = strsplit(els[-1], "\\t")
       ans = structure(sapply(values, `[`, 2), names = sapply(values, `[`, 1))
     }

