6

I am not an expert of SOAP and WSDL but I have Perl code which I would like to port to R.

The Perl code looks like this (from https://www.pharmgkb.org/resources/downloads_and_web_services.jsp):

use SOAP::Lite;
import SOAP::Data 'type';

sub main {
  my $argcount = scalar (@ARGV);
  if ($argcount != 1) {
    print "usage: diseases.pl <PharmGKB accession id>\n";
    exit -1;
  }

  # make a web services call to server
  my $call = SOAP::Lite
    -> readable (1)
    -> uri('PharmGKBItem')
    -> proxy('http://www.pharmgkb.org/services/PharmGKBItem')
    -> searchDisease($ARGV[0]);

  if ($call->fault) {
    print $call->faultcode . ": " . $call->faultstring . "\n";
  } else {
    my $result = $call->result;

The read things about rsoap and SSOAP packages but did not get any nice info. What I need is full support, such as call the service and provide libraries to parse the output. I prefer some libraries rather then raw coding. I am good with XML package and not very good with RCurl. I am correct in thinking that there is no good and current (actively maintained) support in R for this?

Dave X
  • 4,831
  • 4
  • 31
  • 42
userJT
  • 11,486
  • 20
  • 77
  • 88

3 Answers3

5

Checkout the SSOAP package on OmegaHat. It's compatible with both S and R. It even has an genSOAPClientInterface function for generating the available Operations in the WSDL as R functions and generating the associated S4 classes for all of your data types described in the WSDL. It leverages XML and RCurl (both of which were created by the same author). He provides a directory full of examples and pretty useful PDF documentation.

I had a few problems with it when using my WSDL (and am still using modified code to get it to work), but the author of the package is extremely helpful and responsive to bug reports, if you run into issues.

Jeff Allen
  • 17,277
  • 8
  • 49
  • 70
1

I tried to use SSOAP package, but it seems to be quite outdated with bench of issues, including broken dependencies on other packages, namespace conflicts and infinite recursions. It is also removed from Cran together with XMLSchmea package it depends on.

I've used SOAP UI instead in combination with RCurl and it was much more successful approach. RCurl example might be found in another post: https://stackoverflow.com/a/34516458/5189780.

SOAP UI is very easy to use tool for testing and exploration of SOAP web services. It provides XML code for SOAP requests. This XML might be copied and used in R code to form a body of a RCurl request.

0

omegahat.org is not valid anymore but omegahat.net is and the software SSOAP is available for dowload. However, it is not possible to install this package with the R version 3.6.2

gd047
  • 29,749
  • 18
  • 107
  • 146
sveer
  • 427
  • 3
  • 16