Hi all,

i have some troubles with attachment:
i have to get ContentID, ContentLocation and ContentType of all
attachment. I tried with DataHandlers, but i can't get content location,
i tried with IncomingAttachmentStream but i have troubles with them.. i
explain.

  IncomingAttachmentStreams streams =   
            msg.getAttachments().getIncomingAttachmentStreams();
  int attach = 1;
  while (streams.isReadyToGetNextStream()) {
          IncomingAttachmentInputStream stream = 
                                streams.getNextStream();
          if(stream !=null) {
                String contentID = stream.getContentId();
                String contentLocation = stream.getContentLocation();
                String contentType = stream.getContentType();

                ... do my work ...

                stream.close(); //<-- same without this
          }
  }

In this way i can get only one attachment (maybe the first only or one
big attachment.. i don't know.. don't know where i'm wrong), i can get
all info i need (cid, cloc and ctype) but i can access to attachment
only once making my work impossibile (read -> edit -> store).  

With DataHandlers i can do it much easier.. i can get all the
attachment, but i can't get the cloc..

I have to make a new envelope's body adding an element for each
attachment.. this element has also an attribute depending from the
attachment is referred by contentid or contentlocation. 

  if(contentID!=null)
    riferimento.addAttribute("href","cid:"+contentID,ns);
  else
    riferimento.addAttribute("href",contentLocation,ns);

After that i have to detach the old body and add it as message
attachment.

Finally save the whole message (envelope and attachment).


I find this note in the guide:

Note: Axis2 supports content-id based referencing only. Axis2 does not
support Content Location based referencing of MIME parts.

And attachment referenced by cloc??
Here a sample of attachemnt referenced only by content location (last
one) from http://www.w3.org/TR/SOAP-attachments

MIME-Version: 1.0
Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml;
        start="<http://claiming-it.com/claim061400a.xml>"
Content-Description: This is the optional message description.
Content-Location: http://claiming-it.com/

--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <http://claiming-it.com/claim061400a.xml>
Content-Location: claim061400a.xml

<?xml version='1.0' ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
<SOAP-ENV:Body>
..
<theSignedForm href="claim061400a.tiff"/>
..
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--MIME_boundary
Content-Type: image/tiff
Content-Transfer-Encoding: binary
Content-Location: claim061400a.tiff

...binary TIFF image...
--MIME_boundary--





... i'm lost :) 

Thx for any help,
Lorenzo







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to