With SOAP 2.3.1, one uses the SOAPContext class to access attachments, and the SOAPContext instance is obtained from SOAPHTTPConnection. This means doing roughly
SOAPHTTPConnection shc = new SOAPHTTPConnection() ... Call call = new Call(); call.setTransport(shc); ... Response resp = call.invoke(...); SOAPContext ctx = shc.getResponseSOAPContext(); You can then access the message parts from ctx. Scott Nichol Do not send e-mail directly to this e-mail address, because it is filtered to accept only mail from specific mail lists. ----- Original Message ----- From: "Daniel Zhang" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 10:49 AM Subject: Re: Extract Binary File(pdf) from SOAP Attachment I am using Apache SOAP 2.3.1. Thanks. - Daniel Scott Nichol wrote: >Since you mention javax.xml.soap.AttachmentPart, I wonder if you are using Axis, not >Apache SOAP. If so, please post to [EMAIL PROTECTED] If you are using Apache SOAP, >post that info here and someone will help. > >Scott Nichol > >Do not send e-mail directly to this e-mail address, >because it is filtered to accept only mail from >specific mail lists. >----- Original Message ----- >From: "Daniel Zhang" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Monday, March 08, 2004 4:21 PM >Subject: Extract Binary File(pdf) from SOAP Attachment > > >Our client sent us a SOAP file in which they packaged pdf files as >AttachmentPart. Basically if you open the file, it has the following >structure: > >----Boundary_value >Content-Type: application/pdf >Content-Id: pdfnameA > >%PDF-1.4 >...pdf content... >%%EOF > >----Boundary_value >Content-Type: application/pdf >Content-Id: pdfnameB > >%PDF-1.4 >...pdf content... >%%EOF > >Question: How can I extract pdf files from this SOAP attachment? First, >I need to populate this soap file into a SOAPMessage object, then I >tried to use javax.xml.soap.AttachmentPart class, I can use >getContentId() and getContentType() to retrieve the header, but either >java.lang.Object getContent() or getDataHandler() lack the methods to >let me write the pdf content as a string to a file. Any ideas? > >TIA, > >-Daniel > > > >