Friday, 20 November 2015

XML : Connect to a complex SOAP Web Service

I'm tryng to use to this web service in order to get financial information but since I know very little about this language I find it very hard to even connect:

http://www2.sentinelperu.com/ws/asentinelws02.aspx?wsdl

I would really appreciate any help. So far I tried this:

      library(RCurl)        headerFields =       c(Accept = "text/xml",       Accept = "multipart/*",       'Content-Type' = "text/xml; charset=utf-8",       SOAPAction = "http://www2.sentinelperu.com/ws/asentinelws02.aspx?wsdl")        body = '<?xml version="1.0" encoding="utf-8"?>              <soap:Envelope              xmlns:soap="http://www.w3.org/2001/12/soap-envelope"              soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">                <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-                         instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:soap="http://www.w3.org/2001/12/soap-envelope">              <soap:Body>                <Usuario>XXXX</Usuario>              <Password>XXXX</Password>              <Servicio>005</Servicio>              <Tipodoc>42945948</Tipodoc>              <Nrodoc>06594002</Nrodoc>                </soap:Body>              </soap:Envelope>'                  curlPerform(url = "http://www2.sentinelperu.com/ws/asentinelws02.aspx?wsdl",              httpheader = headerFields,              postfields = body              )    

The output is:

       OK        0        <?xml version = "1.0" encoding = "utf-8"?>       <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">       </SOAP-ENV:Envelope>    

No comments:

Post a Comment