[R] Pass Array input to web service

Duncan Temple Lang duncan at wald.ucdavis.edu
Wed Nov 7 00:53:20 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Rohan7 wrote:
> Hello everybody,
>    I'm using SSOAP and RCurl to call webservice. I got success in calling
> webservice with string as
> an input. Now i want to pass array as an input(can be single or
> multidimensional). When i do that i get
> error.
>  unable to find an inherited method for function "toSOAP", for signature
> "data.frame", "textConnection", "NULL"
> 
>   When i remove argument part then it doesn't give any error.
> 
> here is the code
> 
> inputarray <- read.table("path/to/file")
> Server <- SOAPServer("http://192.168.100.1/abc.php")
> result <-  .SOAP(Server, "FunctionName", .soapArgs=list('tempInput' =
> inputarray),action="/abc.php")
> 
> Any suggestions.:working:


Hi.

 I imagine that you are experimenting with both sides of the
client/server interface and so you control all things.
Typically the server is fixed and expects a particular data
type for a parameter in the SOAP call. Once we know this
type (typically from the WSDL for the server), then we can
figure out how to serialize the R object appropriately.
Without that, the two sides have no way to agree on
how to send and how to interpret the information.


But since you are in charge of both sides, then
you can  make up any convention and write the
method for toSOAP that generates the XML representation
of the R object. There are tools in the XML package to aid
generating XML from within R. You could use StatDataML
and the work is already done. You could also
serialize the R object using dump/dput/save etc.
in any format (ASCII or XDR) and then put that
as the content of the XML for that parameter.
It depends what you are going to do with the
result on the server side. R's XDR format would
not be good for a PHP server, but great for an R server.

So there are lots of ways to go about this and you
have to think through both sides or have one already
defined.

There are terminology ambiguities here also.
R's concept of an array and SOAP's are quite different.


> 
> Thanks and regards,
> Rohan7
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHMP5w9p/Jzwa2QP4RAheFAJ9V+ZMwzcA8RbTYcuHMTRE/T6MQKQCfWUlE
dJQyK2byAWPA901TzZyYAT0=
=czhX
-----END PGP SIGNATURE-----



More information about the R-help mailing list