I use the following code to add attachments to an outgoing soap message:
//add an attachment if needed
if (this.attachmentContent != null)
{
for (int i = 0; i < this.attachmentContent.length; i++)
{
DataSource ds = new
ByteArrayDataSource(this.attachmentContent[i].toByteArray(),
this.attachmentContentType[i]);
OMText data = fac.createOMText(new DataHandler(ds), true);
OMElement parent = fac.createOMElement("pdf",null);
parent.addChild(data);
resp.addChild(parent); ;
}
}
I have the following test client that sends and receives a message from
a URLConnection:
charCnt = 0;
in = new BufferedReader( new InputStreamReader(
conn.getInputStream() ) );
out = new BufferedWriter( new FileWriter( OUTPUT_FILE ) );
while ( (response = in.readLine()) != null)
{
out.write( response );
out.write( "\n" );
charCnt += response.length();
}
in.close();
out.flush();
out.close();
When I look at the response output, the attachments in base64 encoded in
the body of the xml. I have <parameter name="enableMTOM"
locked="false">true</parameter> in axis2.xml and am not overriding it in
the services.xml file so why isn't the attachment being sent by
reference? Here is my services.xml file entry for the service I am testing:
<service name="QueryStatisticsReturn" scope="soapsession">
<parameter
name="ServiceClass">org.regenstrief.queryposer.QueryStatisticsReturnServlet</parameter>
<operation name="queryStatisticsReturn">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
</service>
Thanks,
Tammy Dugan
--
Tammy Dugan
Computer Programmer
Regenstrief Institute, Inc.
1050 Wishard Blvd., RG5
Indianapolis, IN 46202
(317) 630 - 7346
Confidentiality Notice: The contents of this message and any files transmitted
with it may contain confidential and/or privileged information and are intended
solely for the use of the named addressee(s). Additionally, the information
contained herein may have been disclosed to you from medical records with
confidentiality protected by federal and state laws. Federal regulations and
State laws prohibit you from making further disclosure of such information
without the specific written consent of the person to whom the information
pertains or as otherwise permitted by such regulations. A general authorization
for the release of medical or other information is not sufficient for this
purpose.
If you have received this message in error, please notify the sender by return
e-mail and delete the original message. Any retention, disclosure, copying,
distribution or use of this information by anyone other than the intended
recipient is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]