You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dan Kaplan <da...@mirthcorp.com> on 2013/12/23 20:52:36 UTC

How do I get the Content-Id out of an Attachment class?

Hi, I'm in the same boat as this guy:
http://stackoverflow.com/questions/18150004/how-to-parse-xop-mtom-soap-response-using-java

TL;DR: I'm using an http connection to call a web service (this is a
requirement of mine).  The WS is returning an mtom message, and now I'm
struggling to parse it.

I've discovered these unit tests that give me a way to extract the
attachments out of the message:
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java


I have used this to deserialize the attachments.  But I can't figure out
how to find the CID of the attachment.  The attachment class has a getId()
method, but this seems to return the first CID of the message, not the one
related to the attachment.  How do I get the CID of the attachment?  For
example, if a message looks like this:

--uuid:870c5f71-c117-4569-9954-8fca719a63d9
        Content-Type: application/xop+xml; charset=UTF-8;
type="application/soap+xml";
        Content-Transfer-Encoding: binary
        Content-ID: <ro...@cxf.apache.org>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header/><soap:Body><RetrieveDocumentSetResponse
xmlns="urn:ihe:iti:xds-b:2007" xmlns:ns10="
http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns11="
http://docs.oasis-open.org/wsn/t-1"
xmlns:ns12="urn:gov:hhs:fha:nhinc:common:subscriptionb2overridefordocuments"
xmlns:ns13="http://nhinc.services.com/schema/auditmessage"
xmlns:ns14="urn:oasis:names:tc:emergency:EDXL:DE:1.0" xmlns:ns15="
http://www.hhs.gov/healthit/nhin/cdc"
xmlns:ns16="urn:gov:hhs:fha:nhinc:common:subscriptionb2overrideforcdc"
xmlns:ns2="urn:gov:hhs:fha:nhinc:common:nhinccommon"
xmlns:ns3="urn:gov:hhs:fha:nhinc:common:nhinccommonentity"
xmlns:ns4="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
xmlns:ns5="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:ns6="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0"
xmlns:ns7="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" xmlns:ns8="
http://docs.oasis-open.org/wsn/b-2" xmlns:ns9="
http://www.w3.org/2005/08/addressing"><ns5:RegistryResponse
status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"/><DocumentResponse><HomeCommunityId>urn:oid:422.422</HomeCommunityId><RepositoryUniqueId>422.422</RepositoryUniqueId><DocumentUniqueId>422.422^KVRJuhCxq4O02_4S</DocumentUniqueId><mimeType>text/xml</mimeType><Document><xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-31@urn%3Aihe%3Aiti%3Axds-b%3A2007"/></Document></DocumentResponse><DocumentResponse><HomeCommunityId>urn:oid:422.422</HomeCommunityId><RepositoryUniqueId>422.422</RepositoryUniqueId><DocumentUniqueId>422.422^22255544631</DocumentUniqueId><mimeType>text/xml</mimeType><Document><xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-32@urn%3Aihe%3Aiti%3Axds-b%3A2007"/></Document></DocumentResponse><DocumentResponse><HomeCommunityId>urn:oid:422.422</HomeCommunityId><RepositoryUniqueId>422.422</RepositoryUniqueId><DocumentUniqueId>422.422^1234566543214425</DocumentUniqueId><mimeType>text/xml</mimeType><Document><xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-33@urn
%3Aihe%3Aiti%3Axds-b%3A2007"/></Document></DocumentResponse></RetrieveDocumentSetResponse></soap:Body></soap:Envelope>
        --uuid:870c5f71-c117-4569-9954-8fca719a63d9
        Content-Type: text/xml
        Content-Transfer-Encoding: binary
        Content-ID: <3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-31@urn
:ihe:iti:xds-b:2007>

        <?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument ...

And I've got the Attachment class for the ClinicalDocument attachment, how
do I get the Content-ID of
3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-31@urn:ihe:iti:xds-b:2007
out of that attachment class?

-- 
Thanks,
Dan

-- 
CONFIDENTIALITY NOTICE: The information contained in this electronic 
transmission may be confidential. If you are not an intended recipient, be 
aware that any disclosure, copying, distribution or use of the information 
contained in this transmission is prohibited and may be unlawful. If you 
have received this transmission in error, please notify us by email reply 
and then erase it from your computer system.

Fwd: How do I get the Content-Id out of an Attachment class?

Posted by Dan Kaplan <da...@mirthcorp.com>.
Hi, I'm in the same boat as this guy:
http://stackoverflow.com/questions/18150004/how-to-parse-xop-mtom-soap-response-using-java

TL;DR: I'm using an http connection to call a web service (this is a
requirement of mine).  The WS is returning an mtom message, and now I'm
struggling to parse it.

I've discovered these unit tests that give me a way to extract the
attachments out of the message:
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java


I have used this to deserialize the attachments.  But I can't figure out
how to find the CID of the attachment.  The attachment class has a getId()
method, but this seems to return the first CID of the message, not the one
related to the attachment.  How do I get the CID of the attachment?  For
example, if a message looks like this:

--uuid:870c5f71-c117-4569-9954-8fca719a63d9
        Content-Type: application/xop+xml; charset=UTF-8;
type="application/soap+xml";
        Content-Transfer-Encoding: binary
        Content-ID: <ro...@cxf.apache.org>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header/><soap:Body><RetrieveDocumentSetResponse
xmlns="urn:ihe:iti:xds-b:2007" xmlns:ns10="
http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns11="
http://docs.oasis-open.org/wsn/t-1"
xmlns:ns12="urn:gov:hhs:fha:nhinc:common:subscriptionb2overridefordocuments"
xmlns:ns13="http://nhinc.services.com/schema/auditmessage"
xmlns:ns14="urn:oasis:names:tc:emergency:EDXL:DE:1.0" xmlns:ns15="
http://www.hhs.gov/healthit/nhin/cdc"
xmlns:ns16="urn:gov:hhs:fha:nhinc:common:subscriptionb2overrideforcdc"
xmlns:ns2="urn:gov:hhs:fha:nhinc:common:nhinccommon"
xmlns:ns3="urn:gov:hhs:fha:nhinc:common:nhinccommonentity"
xmlns:ns4="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
xmlns:ns5="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:ns6="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0"
xmlns:ns7="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" xmlns:ns8="
http://docs.oasis-open.org/wsn/b-2" xmlns:ns9="
http://www.w3.org/2005/08/addressing"><ns5:RegistryResponse
status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"/><DocumentResponse><HomeCommunityId>urn:oid:422.422</HomeCommunityId><RepositoryUniqueId>422.422</RepositoryUniqueId><DocumentUniqueId>422.422^KVRJuhCxq4O02_4S</DocumentUniqueId><mimeType>text/xml</mimeType><Document><xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-31@urn%3Aihe%3Aiti%3Axds-b%3A2007"/></Document></DocumentResponse><DocumentResponse><HomeCommunityId>urn:oid:422.422</HomeCommunityId><RepositoryUniqueId>422.422</RepositoryUniqueId><DocumentUniqueId>422.422^22255544631</DocumentUniqueId><mimeType>text/xml</mimeType><Document><xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-32@urn%3Aihe%3Aiti%3Axds-b%3A2007"/></Document></DocumentResponse><DocumentResponse><HomeCommunityId>urn:oid:422.422</HomeCommunityId><RepositoryUniqueId>422.422</RepositoryUniqueId><DocumentUniqueId>422.422^1234566543214425</DocumentUniqueId><mimeType>text/xml</mimeType><Document><xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-33@urn
%3Aihe%3Aiti%3Axds-b%3A2007"/></Document></DocumentResponse></RetrieveDocumentSetResponse></soap:Body></soap:Envelope>
        --uuid:870c5f71-c117-4569-9954-8fca719a63d9
        Content-Type: text/xml
        Content-Transfer-Encoding: binary
        Content-ID: <3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-31@urn
:ihe:iti:xds-b:2007>

        <?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument ...

And I've got the Attachment class for the ClinicalDocument attachment, how
do I get the Content-ID of
3511c0cc-5e20-46b7-8ae0-406c3b1ea95f-31@urn:ihe:iti:xds-b:2007
out of that attachment class?

-- 
Thanks,
Dan



-- 
Thanks,
Dan

-- 
CONFIDENTIALITY NOTICE: The information contained in this electronic 
transmission may be confidential. If you are not an intended recipient, be 
aware that any disclosure, copying, distribution or use of the information 
contained in this transmission is prohibited and may be unlawful. If you 
have received this transmission in error, please notify us by email reply 
and then erase it from your computer system.