[R] Qualified parameters in SOAP body using .SOAP

Duncan Temple Lang duncan at wald.ucdavis.edu
Wed Jun 24 19:37:15 CEST 2009


Hi Olivier

Olivier Cailloux wrote:
> Hello,
> 
> I am trying to reach a web service using the SOAP package. I succeeded 
> calling the web service, but not sending parameters to it. After much 
> research and tries, I think I found that the problem lies in the 
> namespace including the parameters in the SOAP body.

There's no doubt that the SSOAP package doesn't cover all possible cases
from the SOAP specification. But before adding support for additional
types of server, can you point me to where in the specification or
in the research you did that indicates what the namespace should
be for this situation. That would be helpful.

Since this client - server computing an error could be in either the 
client or the server, or both.   Looking at the WSDL, it appears
that this might have been created manually. Is this the case? and is the 
server implemented via standard toolkits or home-grown? Regardless
of how it is created, we just want to make certain it is correct.

Now, as for an easy solution to the problem....
You can cause the writeSOAPBody() method to avoid defining
a default namespace on the <greetMe> node in the body of the message.
You do this by putting a name on the character vector giving the 
namespaces, e.g.

      xmlns = c(x = "http://web2.web")

in the call.  So

contentGreet <- .SOAP(server=smg8TestService, method="greetMe",
                       arg0="Olivier", action="",
                       xmlns=c(x = "http://web2.web/"),
                       .convert=FALSE)

works just fine.


  D.



> 
> In short, my question is: how can I send unqualified parameters in the 
> SOAP body of a call produced through the SOAP package? Details of what I 
> try to do follow.
> 
> The SOAP package sends this soap envelope to my test web service (wsdl 
> here [http://smg8.ulb.ac.be:8080/web2?wsdl]).
> <SOAP-ENV:Envelope 
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>  <SOAP-ENV:Body>
>    <greetMe xmlns="http://web2.web/">
>      <arg0 xsi:type="xsd:string">Olivier</arg0>
>    </greetMe>
>  </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> The R commands used are:
> library("SSOAP")
> smg8TestService <- SOAPServer("smg8.ulb.ac.be", "/web2/TestService", 8080)
> contentGreet <- .SOAP(server=smg8TestService, method="greetMe", 
> arg0="Olivier", action="", xmlns="http://web2.web/", .convert=FALSE)
> 
> But, AFAIU, the arg0 tag should NOT be qualified, according to the WSDL. 
> Hence, my web service implementation never receives the "Olivier" 
> argument and rather receives "null" as the string parameter.
> 
> When calling the web service using an other client (eclipse Web services 
> explorer), I see it generates the following body:
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:q0="http://web2.web/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>  <soapenv:Body>
>    <q0:greetMe>
>      <arg0>Olivier-from-eclipse</arg0>
>    </q0:greetMe>
>  </soapenv:Body>
> </soapenv:Envelope>
> 
> Thus with the "arg0" tag being unqualified (i.e. not in the 
> "http://web2.web/" namespace). And that works: my web service 
> implementation indeed receives the "Olivier-from-eclipse" parameter as 
> string.
> 
> Can anyone confirm that my understanding of what happens and why my web 
> service implementation, when called by the R client, does not see the 
> parameters, seems correct?
> 
> If it seems correct, then how can I send unqualified parameters in the 
> SOAP body using the SOAP package? Thanks for any help!
> Olivier
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list