Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Extracting SOAP Attachments!! Help!!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have written a web service receiving soap message with attachments.
message is like below. I also written a message handler at the service side to extract attachments.

and its invoke method is like this.

public void invoke(MessageContext arg0) throws AxisFault {
SOAPMessage soapMessage = arg0.getMessage();
Iterator attachments = soapMessage.getAttachments();
while(attachments.hasNext()){
AttachmentPart attachment = (AttachmentPart)attachments.next();

System.out.println("ATTACHMENT CONTENT ID=" + attachment.getContentId());
System.out.println("ATTACHMENT CONTENT LOCATION="+ attachment.getContentLocation());
System.out.println("ATTACHMENT CONTENT TYPE="+ attachment.getContentType());

DataHandler dh = attachment.getDataHandler();
String attachmentContent = CfDataSourceReader.convertToString(dh.getDataSource());
System.out.println("ATTACHMENT CONTTENT BODY=" + attachmentContent);
}
}

i get one attachment and print it like this, although i have two attachment.

------=_Part_34_14069871.1239527371546
Content-Type: multipart/mixed; boundary="----=_Part_38987_26662994.1239527475525"
Content-Transfer-Encoding: binary
Content-Id: <82EBE43CF308A233A1F44B98520D944D>

------=_Part_38987_26662994.1239527475525
Content-Type: application/smil; filename=p.smil; name=p.smil; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-ID: <d6T40>
Content-Location: p.smil
Content-Disposition: Attachment ;Filename="p.smil"

<smil>
<head>
<layout>
<root-layout width="115" height="122" />
<region id="Image" width="100%" height="100%" left="0%" top="0%" fit="meet" />
</layout>
</head>
<body>
<par dur="6000ms">

</par>
</body>
</smil>

------=_Part_38987_26662994.1239527475525
Content-Type: image/jpeg; filename=XXXXXXXXXXXXX.jpg; name=XXXXXXXXXXXXXXXX.jpg
Content-Transfer-Encoding: base64
Content-Location: XXXXXXXXXXXXXX.jpg
Content-Disposition: Attachment ;Filename="XXXXXXXXXXXXX.jpg"
Content-ID: <31loDbypsW>

//////////////BNARYY CONTENT ///////////////////

------=_Part_38987_26662994.1239527475525--

* How can i get those two attachment file contents ?? PLEASE HELP!!! *

------=_Part_34_14069871.1239527371546
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <A58B5257C0B0A1A6C8C8DAC18A19B75D>

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<mm7:TransactionID SOAP-ENV:mustUnderstand="1" xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2">XXXXXXXXXXXXXXXXXXXXXXXXXXXX</mm7:TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<mm7:DeliverReq xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2">
<MM7Version>5.3.0</MM7Version>
<LinkedID>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</LinkedID>
<Subject></Subject>
<Sender>
<Number>XXXXXXXXXXXXXXXXX</Number>
</Sender>
<Recipients><To><Number>3300</Number></To></Recipients>
<TimeStamp>2009-04-12T12:11:14Z</TimeStamp>
<Priority>Normal</Priority>
</mm7:DeliverReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

------=_Part_34_14069871.1239527371546
Content-Type: multipart/mixed; boundary="----=_Part_38987_26662994.1239527475525"
Content-Transfer-Encoding: binary
Content-Id: <82EBE43CF308A233A1F44B98520D944D>

------=_Part_38987_26662994.1239527475525
Content-Type: application/smil; filename=p.smil; name=p.smil; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-ID: <d6T40>
Content-Location: p.smil
Content-Disposition: Attachment ;Filename="p.smil"

<smil>
<head>
<layout>
<root-layout width="115" height="122" />
<region id="Image" width="100%" height="100%" left="0%" top="0%" fit="meet" />
</layout>
</head>
<body>
<par dur="6000ms">

</par>
</body>
</smil>

------=_Part_38987_26662994.1239527475525
Content-Type: image/jpeg; filename=XXXXXXXXXXXXX.jpg; name=XXXXXXXXXXXXXXXX.jpg
Content-Transfer-Encoding: base64
Content-Location: XXXXXXXXXXXXXX.jpg
Content-Disposition: Attachment ;Filename="XXXXXXXXXXXXX.jpg"
Content-ID: <31loDbypsW>
//////////////BNARYY CONTENT ///////////////////
------=_Part_38987_26662994.1239527475525--

------=_Part_34_14069871.1239527371546--
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic