Hi Thilina,
I have log a JIRA(ref number AXIS2-2190). As I have reported in that
bug report, the binary data can be sent by reference if the binary data is
not a member variable of reutrn complex data structure, just itself.
I also have another issue. I have indicated it in another email. AXIS2
can not map java byte[] correctly if the byte[] variable is also a member
variable of complex data structure. It just map byte[] to xml byte, not
base64Binary.
many thanks for your help.
best regards
donald
On 2/15/07, Thilina Gunarathne <[EMAIL PROTECTED]> wrote:
It seems like a bug to me.. Please log a JIRA with resources to replicate
it...
Thanks,
Thilina
On 2/14/07, donald yang <[EMAIL PROTECTED]> wrote:
> Hi Thilina
>
> Sorry I attached the wrong axis2.xml which is from axis2 source
> directory. I had enabled the MTOM in the axis2.xml. But it is still send
> back by value, see[1][2]. Is there any other method to send back
attachment
> so that the attachmetn is sent by reference? Currently I defined the
> attachment variable as OMElement data type.
>
> best regards
> donald
>
> [1] the SOAP message captured by TCPMon
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Content-Type: multipart/related;
> boundary=MIMEBoundaryurn_uuid_982443D5B0716BE3521171462576527;
> type="application/xop+xml"; start="<
> 0.urn:uuid:[EMAIL PROTECTED]>";
> start-info="text/xml";charset=UTF-8Transfer-Encoding:
> chunkedDate: Wed, 14 Feb 2007 14:16:16
>
GMT2ae--MIMEBoundaryurn_uuid_982443D5B0716BE3521171462576527content-type:
> application/xop+xml; charset=UTF-8;
> type="text/xml";content-transfer-encoding:
> binarycontent-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>
> <ns:transferResponse xmlns:ns="
> http://ws.apache.org/axis2/xsd">
> <ns:return>
> <test1:downloadFile xmlns:test1="
> http://ws.apache.org/axis2/xsd">aGVsbG8=</test1:downloadFile>
> <uploadSuccess xmlns="
http://ws.apache.org/axis2/xsd
> ">true</uploadSuccess>
> </ns:return>
> </ns:transferResponse>
> </soapenv:Body>
> </soapenv:Envelope>
>
> [2] some my source code
>
> public class TestService
> {
> ...............
> public TransferResp transfer(String name, String attachment)
> {
> ....................
> }
> }
>
> public class TransferResp
> {
> ....
> 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);
> File file = new File("d:\\test.txt");
> DataHandler dataHandler = new DataHandler(new
FileDataSource(file));
> OMText textData = fac.createOMText(dataHandler, true);
> textData.setOptimize(true);
> textData.setBinary(true);
> downloadFile.addChild(textData);
>
> }
> public OMElement getDownloadFile()
> {
> return downloadFile;
>
> }
> }
> On 2/14/07, Thilina Gunarathne <[EMAIL PROTECTED]> wrote:
> > Please try enabling MTOM in the Axis2.xml... The axis2.xml which you
> > have provided does not have MTOM enabled..
> >
> > Hope you are using TCPMON to sniff the messages...
> >
> > ~Thilina
> >
> > On 2/13/07, donald yang < [EMAIL PROTECTED]> wrote:
> > > Hi Thilina,
> > >
> > > Many thanks for your reply. I have alreay enable MTOM in the
> > > axis2.xml. But the binary data is still sent by value not by
reference
> > > regardless the binary data is sent from client or server. I am
attaching
> my
> > > axis2.xml and service.xml, could you please give me a hand?
> > >
> > > best regards
> > > donald
> > >
> > >
> > > On 2/13/07, Thilina Gunarathne < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi Donald,
> > > > It is a known issue with Axis2 SOAP monitor.. Axis TCPMON is now
> > > > separated out in to a ws-commons project [1].
> > > >
> > > > Please enable MTOM in the Axis2.xml of the server or in the
> > > > service.xml of your service.
> > > > More info [2].
> > > >
> > > > Thanks,
> > > > Thilina
> > > > [1]http://ws.apache.org/commons/tcpmon/
> > > > [2] http://wso2.org/library/264
> > > >
> > > > On 2/13/07, donald yang <[EMAIL PROTECTED]> wrote:
> > > > > 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);
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > >
> > > >
> > > > --
> > > > Thilina Gunarathne
> > > > WSO2, Inc.; http://www.wso2.com/
> > > > Home page: http://webservices.apache.org/~thilina/
> > > > Blog: http://thilinag.blogspot.com/
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Thilina Gunarathne
> > WSO2, Inc.; http://www.wso2.com/
> > Home page: http://webservices.apache.org/~thilina/
> > Blog: http://thilinag.blogspot.com/
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]