Issue with RCurl_SOAP Request with Attachment

r

#1

With the below code, I am trying to attach image001.pdf file to a certain Policy number using a SOAP request. When I run the code, I am getting the status as HTTP 1.1 200 OK but with the
response as no attachment. Could you please suggest any mistake in the below code or please suggest an alternative. Thanks for your help/suggestion 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:externalIdentifier1111111</type:externalIdentifier>
</type:claimRef>
type:isFinishedfalse</type:isFinished>
type:userTaskTypeRef

type:externalIdentifierCAESCorrespondentie</type:externalIdentifier>
</type:userTaskTypeRef>
type:documentList

             <type:document> 

type:documentIdentifierInExtSys100</type:documentIdentifierInExtSys>
type:documentTypeRef</type:documentTypeRef>

type:areContentsStoredInExtSysfalse</type:areContentsStoredInExtSys>
type:isSignedfalse</type:isSigned>
type:filenameimage001.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:streetNameXXXXXXXX XXXXXX</type:streetName>
type:claimRoleRef
type:externalIdentifierXXX</type:externalIdentifier>
</type:claimRoleRef>
</type:origin>
type:dateReceived2017-11-06</type:dateReceived>
type:emailSubjectXXXXXX XXXXX XXXX</type:emailSubject>
type:emailBodyXXXXXXXXXXX</type:emailBody>
type:descriptionXXXXXXXXXXXXX</type:description>
type:emailAddressXXXXXXXXXXXX</type:emailAddress>
type:isComplaintfalse</type:isComplaint>

type:containsMedicalInformationfalse</type:containsMedicalInformation>

type:containsConfidentialInformationfalse</type:containsConfidentialInformation>
type:isMatterOfFraudfalse</type:isMatterOfFraud>
type:communicationTypeRefEmail</type:communicationTypeRef>
type:hasPriorityfalse</type:hasPriority>

type:containsDocumentsInExtSystemfalse</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()