Hi Thilina,
I sent the binary data to my test web service using the source code
posted in my previous email. I found that the SOAP messages I got using
different montior is different. In the SOAP message[1] obtained using
AXIS1.4 TCPMon, the binary data is sent by reference. In the SOAP message
[2] obtained using AXIS2-1.1.1 SOAPMonitor, the binary data is sent by
value. I don't know why they are different.
I also encounter another problem. I can't sent back binary data by
reference from web service to client. I use both monitors, I saw the binary
data is sent by value in both SOAP messages. I have enable MTOM in axis2.xml.
Could you please give me some suggestions?
Many thanks in advance.
best regards
donald
[1] SOAP message I got using AXIS1.4 TCPMon
POST /axis2/services/TestService HTTP/1.1
SOAPAction: "urn:anonOutInOp"
User-Agent: Axis2
Host: localhost:9000
Transfer-Encoding: chunked
Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_A9972CA35225AAC2E311713669497501;
type="application/xop+xml"; start="<
0.urn:uuid:[EMAIL PROTECTED]>";
start-info="text/xml"; charset=UTF-8
3c4
--MIMEBoundaryurn_uuid_A9972CA35225AAC2E311713669497501
content-type: application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding: binary
content-id:
<0.urn:uuid:[EMAIL PROTECTED] >
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
">
<soapenv:Header />
<soapenv:Body>
<test1:transferMessage
xmlns:test1="http://ws.apache.org/axis2/xsd
">
<test1:name>d:\dest.txt</test1:name>
<test1:attachment>
<xop:Include
href="cid:1.urn:uuid:[EMAIL PROTECTED]"
xmlns:xop="http://www.w3.org/2004/08/xop/include" />
</test1:attachment>
</test1:transferMessage>
</soapenv:Body>
</soapenv:Envelope>--MIMEBoundaryurn_uuid_A9972CA35225AAC2E311713669497501content-type:
text/plaincontent-transfer-encoding: binarycontent-id:
<1.urn:uuid:[EMAIL PROTECTED]
hello--MIMEBoundaryurn_uuid_A9972CA35225AAC2E311713669497501--0
[2] SOAP message I got using AXIS1.1.1 SOAPMontior
<test1:transferMessage xmlns:test1="http://ws.apache.org/axis2/xsd ">
<test1:name>d:\dest.txt</test1:name>
<test1:attachment>aGVsbG8=</test1:attachment>
</test1:transferMessage>
When I decode "aGVsbG8=", the value is "hello" which is content of the file
I sent to web service.
[3] code to send attachment from server to client
public class TransferResponse
{
private OMElement downloadFile;
........................
public void setDownloadFile(String fileName)
{
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
"http://ws.apache.org/axis2/xsd", "test1");
downloadFile = fac.createOMElement("downloadFile", omNs);
DataHandler dataHandler = new DataHandler(new
FileDataSource("d:\\test.txt"));
OMText textData = fac.createOMText(dataHandler, true);
textData.setOptimize(true);
downloadFile.addChild(textData);
}
}