Permalink
Browse files

adding ability to deal with embedded documents from retrieve_document…

…_response
  • Loading branch information...
1 parent 8b756da commit 504d72c89052fff02fee37ea5cb5cb9c28f01b2f @rdingwell rdingwell committed Mar 13, 2009
@@ -25,7 +25,9 @@ def execute
if rdsr.request_successful?
docs = []
rdsr.retrieved_documents.each do |rd|
- part = parts.find {|candidate_part| candidate_part[:content_id].eql?('<' + rd[:content_id] + '>')}
+ # hacky yes!, if rd has a content_id that means the response sent the document back as a separate entry in the multipart doc
+ # else it sent it back as a base64 encoded string that has already been parsed by the rd object and set in :content of the returned hash
+ part = rd[:content_id] ? parts.find {|candidate_part| candidate_part[:content_id].eql?('<' + rd[:content_id] + '>')} : rd
doc = {}
doc[:repository_unique_id] = rd[:repository_unique_id]
doc[:document_unique_id] = rd[:document_unique_id]
@@ -1,5 +1,6 @@
module XDS
class RetrieveDocumentSetResponse
+ require 'base64'
attr_reader :retrieved_documents
def initialize
@@ -22,8 +23,14 @@ def parse_soap_response(soap_xml)
'/soapenv:Envelope/soapenv:Body/xdsb:RetrieveDocumentSetResponse/xdsb:DocumentResponse',
COMMON_NAMESPACES) do |dr|
doc = {}
+ # need to check for include or whether the doc is just embedded in the soap message
+ inc = dr.elements['xdsb:Document/xop:Include']
#Nuke the 'cid:' from the front of the content id since it doesn't show up in the mime message headers
- doc[:content_id] = dr.elements['xdsb:Document/xop:Include'].attributes['href'].to_s.sub('cid:', '')
+ if inc
+ doc[:content_id] = dr.elements['xdsb:Document/xop:Include'].attributes['href'].to_s.sub('cid:', '') if dr.elements['xdsb:Document/xop:Include']
+ else
+ doc[:content] = Base64.decode64(dr.elements['xdsb:Document'].text)
+ end
doc[:repository_unique_id] = dr.elements['xdsb:RepositoryUniqueId'].text
doc[:document_unique_id] = dr.elements['xdsb:DocumentUniqueId'].text
@retrieved_documents << doc
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <soapenv:Header>
+ <wsa:Action>urn:ihe:iti:2007:RetrieveDocumentSetResponse</wsa:Action>
+ <wsa:RelatesTo>urn:uuid:d8530350-f230-012b-6cf2-001f5b35ca2c</wsa:RelatesTo>
+ </soapenv:Header>
+ <soapenv:Body>
+ <xdsb:RetrieveDocumentSetResponse xmlns:xdsb="urn:ihe:iti:xds-b:2007">
+ <rs:RegistryResponse xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"/>
+ <xdsb:DocumentResponse>
+ <xdsb:RepositoryUniqueId>1.19.6.24.109.42.1.1</xdsb:RepositoryUniqueId>
+ <xdsb:DocumentUniqueId>1.2.3.4321.1234</xdsb:DocumentUniqueId>
+ <xdsb:mimeType>text/xml</xdsb:mimeType>
+ <xdsb:Document>PENsaW5pY2FsRG9jdW1lbnQgeHNpOnNjaGVtYUxvY2F0aW9uPSJ1cm46aGw3LW9yZzp2MyBodHRwOi8veHJlZzIubmlzdC5nb3Y6ODA4MC9oaXRzcFZhbGlkYXRpb24vc2NoZW1hL2NkYXIyYzMyL2luZnJhc3RydWN0dXJlL2NkYS9DMzJfQ0RBLnhzZCIgeG1sbnM9InVybjpobDctb3JnOnYzIiB4bWxuczpzZHRjPSJ1cm46aGw3LW9yZzpzZHRjIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIj4KICA8dHlwZUlkIHJvb3Q9IjIuMTYuODQwLjEuMTEzODgzLjEuMyIgZXh0ZW5zaW9uPSJQT0NEX0hEMDAwMDQwIi8+CiAgPHRlbXBsYXRlSWQgcm9vdD0iMi4xNi44NDAuMS4xMTM4ODMuMy4yNy4xNzc2IiBhc3NpZ25pbmdBdXRob3JpdHlOYW1lPSJDREEvUjIiLz4KICA8dGVtcGxhdGVJZCByb290PSIyLjE2Ljg0MC4xLjExMzg4My4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PgogICAgICAgICAgPGNvZGUgY29kZT0iMTE0NTAtNCIgZGlzcGxheU5hbWU9IlByb2JsZW1zIiBjb2RlU3lzdGVtPSIyLjE2Ljg0MC4xLjExMzg4My42LjEiIGNvZGVTeXN0ZW1OYW1lPSJMT0lOQyIvPgogICAgICAgICAgPHRpdGxlPkNvbmRpdGlvbnMgb3IgUHJvYmxlbXM8L3RpdGxlPgogICAgICAgICAgPHRleHQ+CiAgICAgICAgICAgIDx0YWJsZSBib3JkZXI9IjEiIHdpZHRoPSIxMDAlIj4KICAgICAgICAgICAgICA8dGhlYWQ+CiAgICAgICAgICAgICAgICA8dHI+CiAgICAgICAgICAgICAgICAgIDx0aD5Qcm9ibGVtIE5hbWU8L3RoPgogICAgICAgICAgICAgICAgICA8dGg+UHJvYmxlbSBUeXBlPC90aD4KICAgICAgICAgICAgICAgICAgPHRoPlByb2JsZW0gRGF0ZTwvdGg+CiAgICAgICAgICAgICAgICA8L3RyPgogICAgICAgICAgICAgIDwvdGhlYWQ+CiAgICAgICAgICAgICAgPHRib2R5PgogICAgICAgICAgICAgICAgPHRyPgogICAgICAgICAgICAgICAgICA8dGQ+CiAgICAgICAgICAgICAgICAgICAgPGNvbnRlbnQgSUQ9InByb2JsZW0tODk5OTgzNzI4Ij5DaHJvbmljIG1peGVkIGhlYWRhY2hlIHN5bmRyb21lIGRpc29yZGVyPC9jb250ZW50PgogICAgICAgICAgICAgICAgICA8L3RkPgogICAgICAgICAgICAgICAgICA8dGQ+RnVuY3Rpb25hbCBMaW1pdGF0aW9uPC90ZD4KICAgICAgICAgICAgICAgICAgPHRkPjE5NzQwNjMwPC90ZD4KICAgICAgICAgICAgICAgIDwvdHI+CiAgICAgICAgICAgICAgPC90Ym9keT4KICAgICAgICAgICAgPC90YWJsZT4KICAgICAgICAgIDwvdGV4dD4KICAgICAgICAgIDxlbnRyeT4KICAgICAgICAgICAgPGFjdCBjbGFzc0NvZGU9IkFDVCIgbW9vZENvZGU9IkVWTiI+CiAgICAg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pdHk8L3RoPgogICAgICAgICAgICAgICAgPC90cj4KICAgICAgICAgICAgICA8L3RoZWFkPgogICAgICAgICAgICAgIDx0Ym9keT4KICAgICAgICAgICAgICAgIDx0cj4KICAgICAgICAgICAgICAgICAgPHRkPkNvZGVpbmU8L3RkPgogICAgICAgICAgICAgICAgICA8dGQ+RHJ1ZyBBbGxlcmd5PC90ZD4KICAgICAgICAgICAgICAgICAgPHRkPgogICAgICAgICAgICAgICAgICAgIDxjb250ZW50IElEPSJzZXZlcml0eS0xMzI0MTI0OTAxIj5NaWxkIHRvIE1vZGVyYXRlPC9jb250ZW50PgogICAgICAgICAgICAgICAgICA8L3RkPgogICAgICAgICAgICAgICAgPC90cj4KICAgICAgICAgICAgICA8L3Rib2R5PgogICAgICAgICAgICA8L3RhYmxlPgogICAgICAgICAgPC90ZXh0PgogICAgICAgICAgPGVudHJ5PgogICAgICAgICAgICA8YWN0IGNsYXNzQ29kZT0iQUNUIiBtb29kQ29kZT0iRVZOIj4KICAgICAgICAgICAgICA8dGVtcGxhdGVJZCByb290PSIyLjE2Ljg0MC4xLjExMzg4My4xMC4yMC4xLjI3Ii8+CiAgICAgICAgICAgICAgPHRlbXBsYXRlSWQgcm9vdD0iMi4xNi44NDAuMS4xMTM4ODMuMy44OC4xMS4zMi42Ii8+CiAgICAgICAgICAgICAgPGlkIHJvb3Q9IjJDNzQ4MTcyLTdDQzItNDkwMi04QUYwLTIzQTEwNUM0NDAxQiIvPgogICAgICAgICAgICAgIDxjb2RlIG51bGxGbGF2b3I9Ik5BIi8+CiAgICAgICAgICAgICAgPGVudHJ5UmVsYXRpb25zaGlwIHR5cGVDb2RlPSJTVUJKIj4KICAgICAgICAgICAgICAgIDxvYnNlcnZhdGlvbiBjbGFzc0NvZGU9Ik9CUyIgbW9vZENvZGU9IkVWTiI+CiAgICAgICAgICAgICAgICAgIDx0ZW1wbGF0ZUlkIHJvb3Q9IjIuMTYuODQwLjEuMTEzODgzLjEwLjIwLjEuMTgiLz4KICAgICAgICAgICAgICAgICAgPGNvZGUgY29kZT0iNDE2MDk4MDAyIiBkaXNwbGF5TmFtZT0iRHJ1ZyBBbGxlcmd5IiBjb2RlU3lzdGVtPSIyLjE2Ljg0MC4xLjExMzg4My42Ljk2IiBjb2RlU3lzdGVtTmFtZT0iU05PTUVEIENUIi8+CiAgICAgICAgICAgICAgICAgIDxzdGF0dXNDb2RlIGNvZGU9ImNvbXBsZXRlZCIvPgogICAgICAgICAgICAgICAgICA8ZWZmZWN0aXZlVGltZT4KICAgICAgICAgICAgICAgICAgICA8bG93IHZhbHVlPSIxOTc0MDYzMCIvPgogICAgICAgICAgICAgICAgICAgIDxoaWdoIHZhbHVlPSIyMDIxMTIyMSIvPgogICAgICAgICAgICAgICAgICA8L2VmZmVjdGl2ZVRpbWU+CiAgICAgICAgICAgICAgICAgIDxwYXJ0aWNpcGFudCB0eXBlQ29kZT0iQ1NNIj4KICAgICAgICAgICAgICAgICAgICA8cGFydGljaXBhbnRSb2xlIGNsYXNzQ29kZT0iTUFOVSI+CiAgICAgICAgICAgICAgICAgICAgICA8cGxheWluZ0VudGl0eSBjbGFzc0NvZGU9Ik1NQVQiPgogICAgICAgICAgICAgICAgICAgICAgICA8Y29kZSBjb2RlPSIyNjcwIiBkaXNwbGF5TmFtZT0iQ29kZWluZSIgY29kZVN5c3RlbT0iMi4xNi44NDAuMS4xMTM4ODMuNi44OCIgY29kZVN5c3RlbU5hbWU9IlJ4Tm9ybSIvPgogICAgICAgICAgICAgICAgICAgICAgICA8bmFtZT5Db2RlaW5lPC9uYW1lPgogICAgICAgICAgICAgICAgICAgICAgPC9wbGF5aW5nRW50aXR5PgogICAgICAgICAgICAgICAgICAgIDwvcGFydGljaXBhbnRSb2xlPgogICAgICAgICAgICAgICAgICA8L3BhcnRpY2lwYW50PgogICAgICAgICAgICAgICAgICA8ZW50cnlSZWxhdGlvbnNoaXAgdHlwZUNvZGU9IlJFRlIiPgogICAgICAgICAgICAgICAgICAgIDxvYnNlcnZh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U9Ind3dy53aGl0ZWhvdXNlLmdvdiIvPgogICAgICAgICAgICAgICAgICA8cGxheWluZ0VudGl0eT4KICAgICAgICAgICAgICAgICAgICA8bmFtZT4KICAgICAgICAgICAgICAgICAgICAgIDxwcmVmaXg+TXIuPC9wcmVmaXg+CiAgICAgICAgICAgICAgICAgICAgICA8Z2l2ZW4gcXVhbGlmaWVyPSJDTCI+V2lsbGlhbTwvZ2l2ZW4+CiAgICAgICAgICAgICAgICAgICAgICA8ZmFtaWx5IHF1YWxpZmllcj0iQlIiPlRhZnQ8L2ZhbWlseT4KICAgICAgICAgICAgICAgICAgICA8L25hbWU+CiAgICAgICAgICAgICAgICAgIDwvcGxheWluZ0VudGl0eT4KICAgICAgICAgICAgICAgIDwvcGFydGljaXBhbnRSb2xlPgogICAgICAgICAgICAgIDwvcGFydGljaXBhbnQ+CiAgICAgICAgICAgICAgPGVudHJ5UmVsYXRpb25zaGlwIHR5cGVDb2RlPSJSRUZSIj4KICAgICAgICAgICAgICAgIDxvYnNlcnZhdGlvbiBjbGFzc0NvZGU9Ik9CUyIgbW9vZENvZGU9IkVWTiI+CiAgICAgICAgICAgICAgICAgIDx0ZW1wbGF0ZUlkIHJvb3Q9IjIuMTYuODQwLjEuMTEzODgzLjEwLjIwLjEuMzciLz4KICAgICAgICAgICAgICAgICAgPGNvZGUgY29kZT0iMzM5OTktNCIgY29kZVN5c3RlbT0iMi4xNi44NDAuMS4xMTM4ODMuNi4xIiBkaXNwbGF5TmFtZT0iU3RhdHVzIi8+CiAgICAgICAgICAgICAgICAgIDxzdGF0dXNDb2RlIGNvZGU9ImNvbXBsZXRlZCIvPgogICAgICAgICAgICAgICAgICA8dmFsdWUgeHNpOnR5cGU9IkNFIiBjb2RlPSI0MjUzOTYwMDAiIGNvZGVTeXN0ZW09IjIuMTYuODQwLjEuMTEzODgzLjYuOTYiIGRpc3BsYXlOYW1lPSJWZXJpZmllZCBXaXRoIEZhbWlseSBPbmx5Ii8+CiAgICAgICAgICAgICAgICA8L29ic2VydmF0aW9uPgogICAgICAgICAgICAgIDwvZW50cnlSZWxhdGlvbnNoaXA+CiAgICAgICAgICAgIDwvb2JzZXJ2YXRpb24+CiAgICAgICAgICA8L2VudHJ5PgogICAgICAgIDwvc2VjdGlvbj4KICAgICAgPC9jb21wb25lbnQ+CiAgICA8L3N0cnVjdHVyZWRCb2R5PgogIDwvY29tcG9uZW50Pgo8L0NsaW5pY2FsRG9jdW1lbnQ+Cg==</xdsb:Document>
+ </xdsb:DocumentResponse>
+ </xdsb:RetrieveDocumentSetResponse>
+ </soapenv:Body>
+</soapenv:Envelope>
@@ -4,6 +4,7 @@ class RetrieveDocumentSetResponseTest < Test::Unit::TestCase
context "A RetrieveDocumentSetRequest" do
setup do
@successful_request_xml = File.read(File.expand_path(File.dirname(__FILE__) + '/../data/successful_document_set_response.xml'))
+ @successful_embedded_request_xml = File.read(File.expand_path(File.dirname(__FILE__) + '/../data/successful_document_set_response_embedded.xml'))
end
should 'properly set the response status for a successful request' do
@@ -24,5 +25,19 @@ class RetrieveDocumentSetResponseTest < Test::Unit::TestCase
assert_equal '1.19.6.24.109.42.1', rd[:repository_unique_id]
assert_equal '1.2.3.4.100000022002209036.1196211173506.1', rd[:document_unique_id]
end
+
+ should "properly parse oout information and document content from embeeded response" do
+
+ rdsr = XDS::RetrieveDocumentSetResponse.new
+ rdsr.parse_soap_response(@successful_embedded_request_xml)
+ assert rdsr.request_successful?
+ rds = rdsr.retrieved_documents
+ assert rds
+ assert_equal 1, rds.length
+ rd = rds.first
+ assert rd[:content]
+ assert_equal '1.19.6.24.109.42.1.1', rd[:repository_unique_id]
+ assert_equal '1.2.3.4321.1234', rd[:document_unique_id]
+ end
end
end

0 comments on commit 504d72c

Please sign in to comment.