我创建了一个soap xml请求,但是当我使用curlPerform时,它会从服务中返回反斜杠。
headerFields =
c(Accept = "text/xml",
'Content-Type' = "text/xml; charset=utf-8")
body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Get>
<tem:request>
<tem:Name>
<tem:string>Name1</tem:string>
</tem:Name>
<tem:StartDate>2015-01-01T10:30:00</tem:StartDate>
<tem:EndDate>2015-01-01T10:30:00</tem:EndDate>
</tem:request>
</tem:Get>
</soapenv:Body>
</soapenv:Envelope>'
h = basicTextGatherer()
h$reset()
curlPerform(url = "service.asmx",
httpheader = headerFields,
postfields = body,
writefunction = h$update
)
body <- h$value()
并以反斜杠返回; 这是回应的开始。
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
<soap:Body><GetResponse xmlns=\"http://tempuri.org/\">
我试图删除反斜杠,但我没有。也许有人知道答案的来源,我就不需要删除它们。