[R] Microsoft SOAP - Help!!

Duncan Temple Lang duncan at wald.ucdavis.edu
Mon Nov 12 23:09:03 CET 2007


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

Hi Konstantinos

 I am not able to reproduce the error. I can use different
search queries of different length, etc.

  The error is coming from libcurl and, if I have gotten things the
right way around, it basically means that the write handler callback
didn't handle the entire collection of text it was given.
Can you

curlPerform(url="http://soap.search.msn.com/webservices.asmx?wsdl",
             httpheader=c(Accept="text/xml", Accept="multipart/*",
                          'Content-Type' = "text/xml; charset=utf-8"),
             postfields=body,
             writefunction = function(txt) { print(txt) ; nchar(txt)},
             verbose = FALSE
 	    )


and verify that the we do get the point where we are processing the
return from the server (and not failing in writing our request to the
server).

If the error is in handling the response from the server, then it may
be that we have to look at the string encodings, etc.


 D.

Metaxab wrote:
> Hello,
> 
> I am trying to access Microsoft Live Search Using SOAP through R.
> In R I am using the RCurl packages to make the calls.
> 
> I have the following situation that looks crazy and cannot figure out how to
> solve it:
> 
> #SOAP Request
> library(RCurl)
> 
> h = basicTextGatherer()
> 
> body='<?xml version="1.0" encoding="ISO-8859-15"?>
> <SOAP-ENV:Envelope
> SOAP-ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd=" http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
> <SOAP-ENV:Body><ns3849:Search xmlns:ns3849="http://tempuri.org">
> <Request><AppID xsi:type="xsd:string">MY ID</AppID>
> <Query xsi:type="xsd:string">"Cancer"</Query>
> <CultureInfo xsi:type="xsd:string">en-US</CultureInfo>
> <SafeSearch xsi:type="xsd:string">Off</SafeSearch>
> <Flags xsi:type="xsd:string"></Flags>
> <Location xsi:type="xsd:string"></Location>
> <Requests><SourceRequest><Source xsi:type="xsd:string">Web</Source>
> <Offset xsi:type="xsd:int">0</Offset>
> <Count xsi:type="xsd:int">10</Count>
> <ResultFields xsi:type="xsd:string">Title</ResultFields>
> </SourceRequest></Requests></Request></ns3849:Search></SOAP-ENV:Body>
> </SOAP-ENV:Envelope>'
> 
> curlPerform(url="http://soap.search.msn.com/webservices.asmx?wsdl",
>             httpheader=c(Accept="text/xml", Accept="multipart/*",
>                          'Content-Type' = "text/xml; charset=utf-8"),
>             postfields=body,
>             writefunction = h$update,
>             verbose = FALSE
> 	    )
> 
> ##Put the responce in body.
> body = h$value()
> h$reset()
> 
> An now the crazy stuff. This code works well for some keywords but not for
> all.
> 
> So for the Query:"Cancer" the code works fine, but for the Query: "Tiger" I
> get the following error message: 
>   Error in curlPerform(url =
> "http://soap.search.msn.com/webservices.asmx?wsdl",  : 
>   Failed writing body
> 
> I cannot figure that out. Please help!!!!
> 
> Thanks 
> Konstantinos Vougas
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHOM7/9p/Jzwa2QP4RAvSGAJ91fdow7OPuihgE9yX+X75BJGiOzgCfapaw
0dni/l4DJjcAkqsEPcRk84E=
=10Tt
-----END PGP SIGNATURE-----



More information about the R-help mailing list