2017-12-20 11 views
0

아래 스크린 샷과 같이 Rstudio에서 올바른 응답을 얻는 SOAP 요청이 있습니다. 응답을 요청하는 데 사용되는 코드는 내가 RStudio에서 무엇입니까 응답은웹 서비스 응답을 R에 저장할 수 없습니다.

Web Service Response

입니다

library(RCurl) 

headerFields = 
    c(Accept = "text/xml", 
    'Content-Type' = "text/xml; charset=utf-8", 
    SOAPAction = "") 

body = '<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.xxxxx.com/esotservice/schema"> 
    <S:Header/> 
<S:Body> 
<sch:OwnerOnlyInquiryRequest> 
<sch:RequestHeader> 
<sch:ClientSystem>ePRS</sch:ClientSystem> 
</sch:RequestHeader> 
<sch:RequestParameterList> 
<sch:RequestParam>12174391</sch:RequestParam> 
</sch:RequestParameterList> 
<sch:RequestType>CESEID</sch:RequestType> 
<sch:PeckingOrder>Pricing</sch:PeckingOrder> 
<sch:ViewType>Pricing</sch:ViewType> 
</sch:OwnerOnlyInquiryRequest> 
</S:Body> 
</S:Envelope>' 

R <- curlPerform(url = "http://slsesotdevt1.ute.xxxx.com:10149/esot/esotservice.wsdl", 
      httpheader = headerFields, 
      postfields = body, verbose=TRUE) 

입니다 내 의도라는 객체로 웹 서비스 응답 (이미지에서 흑백 텍스트)를 저장하는 것입니다

R을 XML로 객체 클래스의 코드에 추가하여 XML 패키지를 사용하여 데이터를 추가로 처리 할 수 ​​있습니다. 나는 인쇄 (R)을 말할 때, 내가 할 수있는 유일한 응답은 응답 0 모두가 제대로 갔다 있음을 나타냅니다 웹을 검색 한 후

Value of object stored in R

입니다. 그러나 실제로 응답을 R에 저장하는 방법이 있습니까? Rstudio의 첫 번째 이미지에 나타나는 검은 색 텍스트를 복사하여 xmlTreeParse와 같은 xml 함수에 공급하면 올바르게 처리됩니다.

답변

0

basicTextGatherer을 사용하여 응답 본문을 가져와야합니다.

는 예를 들어 (https://cran.r-project.org/web/packages/RCurl/RCurl.pdf에서 가져온) :

library(RCurl) 

headerFields = 
    c(Accept = "text/xml", 
    'Content-Type' = "text/xml; charset=utf-8", 
    SOAPAction = "") 

body = '<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.xxxxx.com/esotservice/schema"> 
    <S:Header/> 
<S:Body> 
<sch:OwnerOnlyInquiryRequest> 
<sch:RequestHeader> 
<sch:ClientSystem>ePRS</sch:ClientSystem> 
</sch:RequestHeader> 
<sch:RequestParameterList> 
<sch:RequestParam>12174391</sch:RequestParam> 
</sch:RequestParameterList> 
<sch:RequestType>CESEID</sch:RequestType> 
<sch:PeckingOrder>Pricing</sch:PeckingOrder> 
<sch:ViewType>Pricing</sch:ViewType> 
</sch:OwnerOnlyInquiryRequest> 
</S:Body> 
</S:Envelope>' 

h = basicTextGatherer() 
R <- curlPerform(url = "http://slsesotdevt1.ute.xxxx.com:10149/esot/esotservice.wsdl", 
      httpheader = headerFields, 
      postfields = body, verbose=TRUE, 
writefunction = h$update) 
body <- h$value() 
+0

이것은했다. 고마워요! –

관련 문제