2013-11-25 73 views
1

我有以下薩翁響應:(含票據和其他屬性,如創建日期,創建用戶,位置等)薩翁response.body不包含XML屬性

<?xml version="1.0" encoding="UTF-8"?> 
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <ns2:getSomeAPIResponse xmlns:ns2="http://v2_0.some.webservices.csx.dtv.com/"> 
     <return type="COMMENT" createDate="2013-11-21T10:32:17.000Z" createUser="5" location="BOSTON">my fifth note</return> 
     <return type="COMMENT" createDate="2013-11-21T09:04:18.000Z" createUser="POSSTD" location="BOSTON">fourth note</return> 
     <return type="COMMENT" createDate="2013-11-21T08:49:20.000Z" createUser="POSSTD" location="BOSTON">third note</return> 
     <return type="COMMENT" createDate="2013-11-21T08:43:42.000Z" createUser="POSSTD" location="BOSTON">second note</return> 
     <return type="COMMENT" createDate="2013-11-21T08:43:42.000Z" createUser="POSSTD" location="BOSTON">first note</return> 
     </ns2:getSomeAPIResponse > 
    </S:Body> 
</S:Envelope> 

當我嘗試獲得響應。體,它包含了筆記,但不是attribures如創建用戶,創建日期,地點等,這些缺失,如:

{:get_some_api_response=> 
    {:return=> 
    ["my fifth note", 
    "fourth note", 
    "third note", 
    "second note", 
    "first note"], 
    :"@xmlns:ns2"=>"http://v2_0.some.webservices.csx.dtv.com/"}} 

我需要有這些屬性爲好,如果可能的話,在response.body,或通過任何其他可能的手段。請幫忙嗎?

+0

你的生理反應是怎樣的?打印response.to_xml –

回答

0

它看起來是這樣的:

<?xml version="1.0" encoding="UTF-8"?> 
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <ns2:rCResponse xmlns:ns2="http://v2_0.customer.webservices.csx.dtv.com/"> 
     <return ResponseCode="OK"> 
      <CustomerID>2072</CustomerID> 
      <SignupDate>2013-11-13Z</SignupDate> 
      </LastUpdateInfo> 
      <Affiliation /> 
     <Notes> 
       <Note createDate="2013-11-25T12:08:22.000Z" createUser="16" location="NCR">sixth note</Note> 
       <Note createDate="2013-11-21T08:43:42.000Z" createUser="PSTD" location="BOSSTON">second note</Note> 
       <Note createDate="2013-11-21T08:43:42.000Z" createUser="PSTD" location="BOSSTON">first note</Note> 
       <MaskData>false</MaskData> 
     </Notes> 
      <CustomerCards /> 
      <MaskData>false</MaskData> 
     </return> 
     </ns2:rCResponse> 
    </S:Body> 
</S:Envelope> 

我懷疑這發生在XML節點元素具有屬性和價值。任何洞察這種情況?