RCurl_SOAP Request with Attachment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RCurl_SOAP Request with Attachment

KarthikDG
I am trying for a SOAP request with an attachment but without success. Could
you please suggest on the below code. Thanks in advance.

library(RCurl)
library(XML)

body = '<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:inc="http://www.XXXXXXX.com/XXX/soap/incomingcommunicationservice"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:type="http://www.XXXXXXX.com/XXX/soap/incomingcommunicationservice/type">
   <soapenv:Header/>
    <soapenv:Body>
      <inc:storeIncomingCommunication>
         <type:storeIncomingCommunicationRequest>
            <type:incomingCommunication>
               <type:claimRef>
                  <type:externalIdentifier>1111111</type:externalIdentifier>
               </type:claimRef>
                <type:isFinished>false</type:isFinished>
               <type:userTaskTypeRef>
                 
<type:externalIdentifier>CAESCorrespondentie</type:externalIdentifier>
               </type:userTaskTypeRef>
               <type:documentList>
               
                  <type:document>
                   
<type:documentIdentifierInExtSys>100</type:documentIdentifierInExtSys>
                     <type:documentTypeRef></type:documentTypeRef>
                   
<type:areContentsStoredInExtSys>false</type:areContentsStoredInExtSys>
                     <type:isSigned>false</type:isSigned>
                       <type:filename>image001.pdf</type:filename>
                     <type:inboundReturnDocumentIdentifier/>
                  </type:document>
                 
               </type:documentList>
               <type:origin>
                  <type:initials>X.X.</type:initials>
                  <type:name>XXX XXXXX</type:name>
                  <type:city>XXXXXXXX</type:city>
                  <type:postalCode>1111XX</type:postalCode>
                  <type:houseNumber>11</type:houseNumber>
                  <type:houseNumberExtension>?</type:houseNumberExtension>
                 
                 
<type:unstructuredHouseNumber>?</type:unstructuredHouseNumber>
                  <type:streetName>XXXXXXXX XXXXXX</type:streetName>
                  <type:claimRoleRef>
                     <type:externalIdentifier>XXX</type:externalIdentifier>
                  </type:claimRoleRef>
               </type:origin>
               <type:dateReceived>2017-11-06</type:dateReceived>
               <type:emailSubject>XXXXXX XXXXX XXXX</type:emailSubject>
               <type:emailBody>XXXXXXXXXXX</type:emailBody>
               <type:description>XXXXXXXXXXXXX</type:description>
               <type:emailAddress>XXXXXXXXXXXX</type:emailAddress>
               <type:isComplaint>false</type:isComplaint>
             
<type:containsMedicalInformation>false</type:containsMedicalInformation>
             
<type:containsConfidentialInformation>false</type:containsConfidentialInformation>
               <type:isMatterOfFraud>false</type:isMatterOfFraud>
               <type:communicationTypeRef>Email</type:communicationTypeRef>
               <type:hasPriority>false</type:hasPriority>
             
<type:containsDocumentsInExtSystem>false</type:containsDocumentsInExtSystem>
             
            </type:incomingCommunication>
         </type:storeIncomingCommunicationRequest>
         <type:document1 href="image001.pdf"/>
      </inc:storeIncomingCommunication>
   </soapenv:Body>
</soapenv:Envelope>
'
reader = basicTextGatherer()

options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem",
package = "RCurl"), followlocation = TRUE,                                                  
httpheader = c(Accept = "text/xml",Accept = "multipart/*",'Content-Type' =
"text/xml; charset=utf-8",                                                  
SOAPAction="INTRANET URL"), userpwd = "USERID:PASSWORD", netrc =
TRUE,timeout = 100,    postfields = body, writefunction = reader$update,
verbose=TRUE,httpauth=AUTH_BASIC))

response_IncomingCommunicationService <- getForm("INTRANET URL",
                                                        file =
fileUpload(filename = "C:\\Users\\USERNAME\\Desktop\\image001.pdf",
contentType = "application/pdf"),upload=TRUE)

response_IncomingCommunicationService_html <-
htmlTreeParse(response_IncomingCommunicationService)$children$html

response_IncomingCommunicationService_html
closeAllConnections()

For the above code, I am getting the status as HTTP 1.1 200 OK but with the
response as no attachment.

Could you please check and let me know whether I am missing anything.




--
Sent from: http://r.789695.n4.nabble.com/datatable-help-f2315188.html
_______________________________________________
datatable-help mailing list
[hidden email]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help