You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Maria McCafferty <ma...@mobilecohesion.com> on 2007/02/08 16:28:06 UTC

Problem retrieving ENABLE_MTOM value

Hi,

I am using Axis2 version 1.1.1. I have a client sending either and MTOM or SwA message. Here is part of the
client code for sending an MTOM message:

   	ServiceClient service = new ServiceClient();
    	Options options = new Options();
        options.setTo(targetEPR);
    	options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

    	service.setOptions(options);

        OMElement payload = createPayload();

    	OMFactory fac = OMAbstractFactory.getOMFactory();  

    	DataHandler dataHandler = new DataHandler(createSoapMimeDataSource());

    	OMText textData = fac.createOMText(dataHandler, true);

    	textData.setOptimize(true);

    	payload.addChild(textData);

    	OMElement res = service.sendReceive(payload);

The SwA/MTOM request messages are fine and I am able to retrieve the attachments.
As you can see, I set the property ENABLE_MTOM to true. However I am having problems retrieving 
the value from my server code. I am trying to access it by calling:

	MessageContext.getCurrentMessageContext().isDoingMTOM()

I thought this would return true given that the option was set in the Client. I have also checked the
list of properties, and it is not included. I am getting the same problem when sending an SwA request - 
isDoingMTOM, isDoingSwA and isDoingREST are all set to false. I realise I can check the for the xop header,
but felt that the above should work.

Thanks,
Maria


POST /mm7 HTTP/1.1

SOAPAction: "urn:anonOutInOp"
User-Agent: Axis2
Transfer-Encoding: chunked
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_29526B260178FA14181170945919864; type="application/xop+xml"; start="<0....@apache.org>"; start-info="text/xml"; charset=UTF-8

2495
--MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
content-type: application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding: binary
content-id: <0....@apache.org>

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><SendMms><xop:Include href="cid:1.urn:uuid:29526B260178FA14181170945919896@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"></xop:Include>
<RequestElement>
.
.
.
</RequestElement></soapenv:Body></soapenv:Envelope>

--MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
content-type: multipart/related; 
.boundary="----=_Part_0_23276589.1170945917770"
content-transfer-encoding: binary
content-id: <1....@apache.org>

------=_Part_0_23276589.1170945917770
Content-Type: text/plain

first attachment

------=_Part_0_23276589.1170945917770
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Location: attach2.jpg
Content-Id: attach2.jpg

<content>
------=_Part_0_23276589.1170945917770--



--MIMEBoundaryurn_uuid_29526B260178FA14181170945919864--



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by Thilina Gunarathne <cs...@gmail.com>.
> isDoingMTOM, isDoingSwA and isDoingREST are all set to false.

All of the above things are used by the transport layer and populated
only by the transport layers when sending messages.
Yes.. I do agree and believe that we should remove these or we used
make them work consistently in all the places..

Please submit a Jira.. Hope you would be able to live with the headers
workaround for the moment..

Thanks,
Thilina

> Maria
>
>
> POST /mm7 HTTP/1.1
>
> SOAPAction: "urn:anonOutInOp"
> User-Agent: Axis2
> Transfer-Encoding: chunked
> Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_29526B260178FA14181170945919864; type="application/xop+xml"; start="<0....@apache.org>"; start-info="text/xml"; charset=UTF-8
>
> 2495
> --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> content-type: application/xop+xml; charset=UTF-8; type="text/xml";
> content-transfer-encoding: binary
> content-id: <0....@apache.org>
>
> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><SendMms><xop:Include href="cid:1.urn:uuid:29526B260178FA14181170945919896@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"></xop:Include>
> <RequestElement>
> .
> .
> .
> </RequestElement></soapenv:Body></soapenv:Envelope>
>
> --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> content-type: multipart/related;
> .boundary="----=_Part_0_23276589.1170945917770"
> content-transfer-encoding: binary
> content-id: <1....@apache.org>
>
> ------=_Part_0_23276589.1170945917770
> Content-Type: text/plain
>
> first attachment
>
> ------=_Part_0_23276589.1170945917770
> Content-Type: image/jpeg
> Content-Transfer-Encoding: base64
> Content-Location: attach2.jpg
> Content-Id: attach2.jpg
>
> <content>
> ------=_Part_0_23276589.1170945917770--
>
>
>
> --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864--
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by donald yang <do...@googlemail.com>.
Hi, Maria and Thilina,
      Many thanks for your reply. I have read your code, no difference
between yours and mine. Even if I changed the code as yours, I still can saw
that the binary data is sent by value not by reference. Here is my code:

    try {
                 EndpointReference targetEPR = new EndpointReference(
                "http://localhost:8080/axis2/services/TestService");
               ServiceClient service = new ServiceClient();
               Options options = new Options();
               options.setTo(targetEPR);
               options.setProperty(Constants.Configuration.ENABLE_MTOM,
                       Constants.VALUE_TRUE);
               service.setOptions(options);



               OMFactory fac = OMAbstractFactory.getOMFactory();
               OMNamespace omNs = fac.createOMNamespace(
                       "http://ws.apache.org/axis2/xsd", "test1");
               OMElement payload = fac.createOMElement("transferMessage",
omNs);

               DataHandler dataHandler = new DataHandler(new
                       FileDataSource("d:\\test.txt"));
               OMText textData = fac.createOMText(dataHandler, true);
               textData.setOptimize(true);

               //the destination that the upload file should be saved in
               OMElement childNode = fac.createOMElement("name", omNs);
               childNode.setText("d:\\dest.txt");

                payload.addChild(childNode);

               //add tthe attachment
                childNode = fac.createOMElement("attachment", omNs);
                childNode.addChild(textData);
                payload.addChild(childNode);
                OMElement res = service.sendReceive(payload);

           } catch (AxisFault axisFault) {
               System.out.println("Caught axis exception");
               axisFault.printStackTrace();
           }

The file, test.txt, only contains simple text "hello".

The soap message is as follows:
<test1:transferMessage xmlns:test1="http://ws.apache.org/axis2/xsd">
<test1:name>d:\dest.txt</test1:name><test1:attachment>aGVsbG8=</test1:attachment></test1:transferMessage>


On 2/9/07, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> Donald,
> If possible please post the source of the place you are creating the
> OMText.. In you case you can use a FileDataSource to create the data
> handler and then you can create the OMText using that..
>
> ~Thilina
>
> On 2/8/07, donald yang <do...@googlemail.com> wrote:
> > Hi, Maria,
> >
> >     I am trying to send attachment to a web service using AXIS2-1.1.1.
> But
> > the binary data is sent by value not by reference. My client also
> enabled
> > MTOM and set optimization of OMText to TRUE. The only difference is that
> you
> > use createSoapMimeDataSource()( I don't know how you implement it), I
> > directly pass a  FILE variable. Could you please give me one complete
> > example how to sent attachment in client side? Sorry for interrupt you.
> >
> > best regards
> > donald
> >
> >
> > On 2/8/07, Maria McCafferty
> > <maria.mccafferty@mobilecohesion.com > wrote:
> > > Hi,
> > >
> > > I am using Axis2 version 1.1.1. I have a client sending either and
> MTOM or
> > SwA message. Here is part of the
> > > client code for sending an MTOM message:
> > >
> > >         ServiceClient service = new ServiceClient();
> > >         Options options = new Options();
> > >         options.setTo(targetEPR);
> > >
> > options.setProperty(Constants.Configuration.ENABLE_MTOM ,
> > Constants.VALUE_TRUE);
> > >
> > >         service.setOptions(options);
> > >
> > >         OMElement payload = createPayload();
> > >
> > >         OMFactory fac = OMAbstractFactory.getOMFactory();
> > >
> > >         DataHandler dataHandler = new
> > DataHandler(createSoapMimeDataSource());
> > >
> > >         OMText textData = fac.createOMText(dataHandler, true);
> > >
> > >         textData.setOptimize(true);
> > >
> > >         payload.addChild(textData);
> > >
> > >         OMElement res = service.sendReceive(payload);
> > >
> > > The SwA/MTOM request messages are fine and I am able to retrieve the
> > attachments.
> > > As you can see, I set the property ENABLE_MTOM to true. However I am
> > having problems retrieving
> > > the value from my server code. I am trying to access it by calling:
> > >
> > >
> > MessageContext.getCurrentMessageContext().isDoingMTOM()
> > >
> > > I thought this would return true given that the option was set in the
> > Client. I have also checked the
> > > list of properties, and it is not included. I am getting the same
> problem
> > when sending an SwA request -
> > > isDoingMTOM, isDoingSwA and isDoingREST are all set to false. I
> realise I
> > can check the for the xop header,
> > > but felt that the above should work.
> > >
> > > Thanks,
> > > Maria
> > >
> > >
> > > POST /mm7 HTTP/1.1
> > >
> > > SOAPAction: "urn:anonOutInOp"
> > > User-Agent: Axis2
> > > Transfer-Encoding: chunked
> > > Content-Type: multipart/related;
> > boundary=MIMEBoundaryurn_uuid_29526B260178FA14181170945919864;
> > type="application/xop+xml"; start="<
> > 0.urn:uuid:29526B260178FA14181170945919865@apache.org>";
> > start-info="text/xml"; charset=UTF-8
> > >
> > > 2495
> > > --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> > > content-type: application/xop+xml; charset=UTF-8; type="text/xml";
> > > content-transfer-encoding: binary
> > > content-id:
> > <0....@apache.org>
> > >
> > > <?xml version="1.0 " encoding="UTF-8"?><soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> "><soapenv:Header></soapenv:Header><soapenv:Body><SendMms><xop:Include
> > href="cid:
> > 1.urn:uuid:29526B260178FA14181170945919896@apache.org"
> > xmlns:xop="http://www.w3.org/2004/08/xop/include
> > "></xop:Include>
> > > <RequestElement>
> > > .
> > > .
> > > .
> > > </RequestElement></soapenv:Body></soapenv:Envelope>
> > >
> > > --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> > > content-type: multipart/related;
> > > .boundary="----=_Part_0_23276589.1170945917770"
> > > content-transfer-encoding: binary
> > > content-id:
> > <1.urn:uuid:29526B260178FA14181170945919896@apache.org >
> > >
> > > ------=_Part_0_23276589.1170945917770
> > > Content-Type: text/plain
> > >
> > > first attachment
> > >
> > > ------=_Part_0_23276589.1170945917770
> > > Content-Type: image/jpeg
> > > Content-Transfer-Encoding: base64
> > > Content-Location: attach2.jpg
> > > Content-Id: attach2.jpg
> > >
> > > <content>
> > > ------=_Part_0_23276589.1170945917770--
> > >
> > >
> > >
> > > --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864--
> > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
>
>
> --
> Thilina Gunarathne
> WSO2, Inc.; http://www.wso2.com/
> Home page: http://webservices.apache.org/~thilina/
> Blog: http://thilinag.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Problem retrieving ENABLE_MTOM value

Posted by donald yang <do...@googlemail.com>.
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 <cs...@gmail.com> 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 <do...@googlemail.com> 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:982443D5B0716BE3521171462576528@apache.org>";
> > 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....@apache.org>
> >       <?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 <cs...@gmail.com> 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 < donaldyy@googlemail.com> 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 < csethil@gmail.com> 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 <do...@googlemail.com> 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:A9972CA35225AAC2E311713669497502@apache.org
> > > > >";
> > > > > > 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:A9972CA35225AAC2E311713669497502@apache.org
> > > > > > >
> > > > > >       <?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:A9972CA35225AAC2E311713669497653@apache.org"
> > > > > > 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:A9972CA35225AAC2E311713669497653@apache.org
> >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:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Thilina Gunarathne
> > > WSO2, Inc.; http://www.wso2.com/
> > > Home page: http://webservices.apache.org/~thilina/
> > > Blog: http://thilinag.blogspot.com/
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Thilina Gunarathne
> WSO2, Inc.; http://www.wso2.com/
> Home page: http://webservices.apache.org/~thilina/
> Blog: http://thilinag.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Problem retrieving ENABLE_MTOM value

Posted by Thilina Gunarathne <cs...@gmail.com>.
It seems like a bug to me.. Please log a JIRA with resources to replicate it...

Thanks,
Thilina

On 2/14/07, donald yang <do...@googlemail.com> 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:982443D5B0716BE3521171462576528@apache.org>";
> 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....@apache.org>
>       <?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 <cs...@gmail.com> 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 < donaldyy@googlemail.com> 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 < csethil@gmail.com> 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 <do...@googlemail.com> 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:A9972CA35225AAC2E311713669497502@apache.org
> > > >";
> > > > > 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:A9972CA35225AAC2E311713669497502@apache.org
> > > > > >
> > > > >       <?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:A9972CA35225AAC2E311713669497653@apache.org"
> > > > > 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....@apache.org>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:
> > > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Thilina Gunarathne
> > WSO2, Inc.; http://www.wso2.com/
> > Home page: http://webservices.apache.org/~thilina/
> > Blog: http://thilinag.blogspot.com/
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by donald yang <do...@googlemail.com>.
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:982443D5B0716BE3521171462576528@apache.org>";
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....@apache.org>
      <?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 <cs...@gmail.com> 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 <do...@googlemail.com> 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 < csethil@gmail.com> 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 <do...@googlemail.com> 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:A9972CA35225AAC2E311713669497502@apache.org
> > >";
> > > > 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:A9972CA35225AAC2E311713669497502@apache.org
> > > > >
> > > >       <?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:A9972CA35225AAC2E311713669497653@apache.org"
> > > > 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:A9972CA35225AAC2E311713669497653@apache.org
> >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:
> > axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Thilina Gunarathne
> WSO2, Inc.; http://www.wso2.com/
> Home page: http://webservices.apache.org/~thilina/
> Blog: http://thilinag.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Problem retrieving ENABLE_MTOM value

Posted by Thilina Gunarathne <cs...@gmail.com>.
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 <do...@googlemail.com> 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 < csethil@gmail.com> 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 <do...@googlemail.com> 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:A9972CA35225AAC2E311713669497502@apache.org
> >";
> > > 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:A9972CA35225AAC2E311713669497502@apache.org
> > > >
> > >       <?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:A9972CA35225AAC2E311713669497653@apache.org"
> > > 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....@apache.org>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:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by donald yang <do...@googlemail.com>.
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 <cs...@gmail.com> 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 <do...@googlemail.com> 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:A9972CA35225AAC2E311713669497502@apache.org>";
> > 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:A9972CA35225AAC2E311713669497502@apache.org
> > >
> >       <?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:A9972CA35225AAC2E311713669497653@apache.org"
> > 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:A9972CA35225AAC2E311713669497653@apache.org
> >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: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Problem retrieving ENABLE_MTOM value

Posted by Thilina Gunarathne <cs...@gmail.com>.
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 <do...@googlemail.com> 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:A9972CA35225AAC2E311713669497502@apache.org>";
> 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:A9972CA35225AAC2E311713669497502@apache.org
> >
>       <?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:A9972CA35225AAC2E311713669497653@apache.org"
> 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....@apache.org>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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by donald yang <do...@googlemail.com>.
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:A9972CA35225AAC2E311713669497502@apache.org>";
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:A9972CA35225AAC2E311713669497502@apache.org >
      <?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:A9972CA35225AAC2E311713669497653@apache.org"
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:A9972CA35225AAC2E311713669497653@apache.org
>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);
  }

}

Re: Problem retrieving ENABLE_MTOM value

Posted by Thilina Gunarathne <cs...@gmail.com>.
Donald,
If possible please post the source of the place you are creating the
OMText.. In you case you can use a FileDataSource to create the data
handler and then you can create the OMText using that..

~Thilina

On 2/8/07, donald yang <do...@googlemail.com> wrote:
> Hi, Maria,
>
>     I am trying to send attachment to a web service using AXIS2-1.1.1. But
> the binary data is sent by value not by reference. My client also enabled
> MTOM and set optimization of OMText to TRUE. The only difference is that you
> use createSoapMimeDataSource()( I don't know how you implement it), I
> directly pass a  FILE variable. Could you please give me one complete
> example how to sent attachment in client side? Sorry for interrupt you.
>
> best regards
> donald
>
>
> On 2/8/07, Maria McCafferty
> <maria.mccafferty@mobilecohesion.com > wrote:
> > Hi,
> >
> > I am using Axis2 version 1.1.1. I have a client sending either and MTOM or
> SwA message. Here is part of the
> > client code for sending an MTOM message:
> >
> >         ServiceClient service = new ServiceClient();
> >         Options options = new Options();
> >         options.setTo(targetEPR);
> >
> options.setProperty(Constants.Configuration.ENABLE_MTOM ,
> Constants.VALUE_TRUE);
> >
> >         service.setOptions(options);
> >
> >         OMElement payload = createPayload();
> >
> >         OMFactory fac = OMAbstractFactory.getOMFactory();
> >
> >         DataHandler dataHandler = new
> DataHandler(createSoapMimeDataSource());
> >
> >         OMText textData = fac.createOMText(dataHandler, true);
> >
> >         textData.setOptimize(true);
> >
> >         payload.addChild(textData);
> >
> >         OMElement res = service.sendReceive(payload);
> >
> > The SwA/MTOM request messages are fine and I am able to retrieve the
> attachments.
> > As you can see, I set the property ENABLE_MTOM to true. However I am
> having problems retrieving
> > the value from my server code. I am trying to access it by calling:
> >
> >
> MessageContext.getCurrentMessageContext().isDoingMTOM()
> >
> > I thought this would return true given that the option was set in the
> Client. I have also checked the
> > list of properties, and it is not included. I am getting the same problem
> when sending an SwA request -
> > isDoingMTOM, isDoingSwA and isDoingREST are all set to false. I realise I
> can check the for the xop header,
> > but felt that the above should work.
> >
> > Thanks,
> > Maria
> >
> >
> > POST /mm7 HTTP/1.1
> >
> > SOAPAction: "urn:anonOutInOp"
> > User-Agent: Axis2
> > Transfer-Encoding: chunked
> > Content-Type: multipart/related;
> boundary=MIMEBoundaryurn_uuid_29526B260178FA14181170945919864;
> type="application/xop+xml"; start="<
> 0.urn:uuid:29526B260178FA14181170945919865@apache.org>";
> start-info="text/xml"; charset=UTF-8
> >
> > 2495
> > --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> > content-type: application/xop+xml; charset=UTF-8; type="text/xml";
> > content-transfer-encoding: binary
> > content-id:
> <0....@apache.org>
> >
> > <?xml version="1.0 " encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><SendMms><xop:Include
> href="cid:
> 1.urn:uuid:29526B260178FA14181170945919896@apache.org"
> xmlns:xop="http://www.w3.org/2004/08/xop/include
> "></xop:Include>
> > <RequestElement>
> > .
> > .
> > .
> > </RequestElement></soapenv:Body></soapenv:Envelope>
> >
> > --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> > content-type: multipart/related;
> > .boundary="----=_Part_0_23276589.1170945917770"
> > content-transfer-encoding: binary
> > content-id:
> <1.urn:uuid:29526B260178FA14181170945919896@apache.org >
> >
> > ------=_Part_0_23276589.1170945917770
> > Content-Type: text/plain
> >
> > first attachment
> >
> > ------=_Part_0_23276589.1170945917770
> > Content-Type: image/jpeg
> > Content-Transfer-Encoding: base64
> > Content-Location: attach2.jpg
> > Content-Id: attach2.jpg
> >
> > <content>
> > ------=_Part_0_23276589.1170945917770--
> >
> >
> >
> > --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864--
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by Maria McCafferty <ma...@mobilecohesion.com>.
Hi,

Thanks for the information, Thilina !

Donald, I have included a bit of code to read in a jpg and send in by 
reference. The createSoapMimeDataSource() in the previous code example 
creates a multipart/related (MimeMultipart)
attachment and returns a javax.mail.MultipartDataSource. I created my 
own implementation of MultipartDataSource which simply took in a 
MimePart and returns the data as a ByteArrayInputStream.
Hope this helps.


       try {
            ServiceClient service = new ServiceClient();
            Options options = new Options();
            options.setTo(targetEPR);
            options.setProperty(Constants.Configuration.ENABLE_MTOM, 
Constants.VALUE_TRUE);
            service.setOptions(options);

            OMElement payload = createPayload();

            OMFactory fac = OMAbstractFactory.getOMFactory();

            DataHandler dataHandler = new DataHandler(new 
FileDataSource("c:\\attach.jpg"));
            OMText textData = fac.createOMText(dataHandler, true);
             textData.setOptimize(true);

             payload.addChild(textData);
             OMElement res = service.sendReceive(payload);
         
        } catch (AxisFault axisFault) {
            System.out.println("Caught axis exception");
            axisFault.printStackTrace();
        } catch (XMLStreamException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
  
POST /mm7 HTTP/1.1
SOAPAction: "urn:anonOutInOp"
User-Agent: Axis2
Transfer-Encoding: chunked

Content-Type: multipart/related; 
boundary=MIMEBoundaryurn_uuid_BBEEC37C31C4F665351171030094842; 
type="application/xop+xml"; 
start="<0....@apache.org>"; 
start-info="text/xml"; charset=UTF-8

245b
--MIMEBoundaryurn_uuid_BBEEC37C31C4F665351171030094842
content-type: application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding: binary
content-id: <0....@apache.org>

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><Message><xop:Include 
href="cid:1.urn:uuid:BBEEC37C31C4F665351171030094854@apache.org" 
xmlns:xop="http://www.w3.org/2004/08/xop/include"></xop:Include>
.
.
.
</Message></soapenv:Body></soapenv:Envelope>

--MIMEBoundaryurn_uuid_BBEEC37C31C4F665351171030094842
content-type: image/jpeg
content-transfer-encoding: binary
content-id: <1....@apache.org>

<content>


Maria


donald yang wrote:

> Hi, Maria,
>
>     I am trying to send attachment to a web service using AXIS2-1.1.1. 
> But the binary data is sent by value not by reference. My client also 
> enabled MTOM and set optimization of OMText to TRUE. The only 
> difference is that you use createSoapMimeDataSource()( I don't know 
> how you implement it), I directly pass a  FILE variable. Could you 
> please give me one complete example how to sent attachment in client 
> side? Sorry for interrupt you.
>
> best regards
> donald
>
> On 2/8/07, *Maria McCafferty* <maria.mccafferty@mobilecohesion.com 
> <ma...@mobilecohesion.com>> wrote:
>
>     Hi,
>
>     I am using Axis2 version 1.1.1. I have a client sending either and
>     MTOM or SwA message. Here is part of the
>     client code for sending an MTOM message:
>
>             ServiceClient service = new ServiceClient();
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setProperty(Constants.Configuration.ENABLE_MTOM ,
>     Constants.VALUE_TRUE);
>
>             service.setOptions(options);
>
>             OMElement payload = createPayload();
>
>             OMFactory fac = OMAbstractFactory.getOMFactory();
>
>             DataHandler dataHandler = new
>     DataHandler(createSoapMimeDataSource());
>
>             OMText textData = fac.createOMText(dataHandler, true);
>
>             textData.setOptimize(true);
>
>             payload.addChild(textData);
>
>             OMElement res = service.sendReceive(payload);
>
>     The SwA/MTOM request messages are fine and I am able to retrieve
>     the attachments.
>     As you can see, I set the property ENABLE_MTOM to true. However I
>     am having problems retrieving
>     the value from my server code. I am trying to access it by calling:
>
>             MessageContext.getCurrentMessageContext().isDoingMTOM()
>
>     I thought this would return true given that the option was set in
>     the Client. I have also checked the
>     list of properties, and it is not included. I am getting the same
>     problem when sending an SwA request -
>     isDoingMTOM, isDoingSwA and isDoingREST are all set to false. I
>     realise I can check the for the xop header,
>     but felt that the above should work.
>
>     Thanks,
>     Maria
>
>
>     POST /mm7 HTTP/1.1
>
>     SOAPAction: "urn:anonOutInOp"
>     User-Agent: Axis2
>     Transfer-Encoding: chunked
>     Content-Type: multipart/related;
>     boundary=MIMEBoundaryurn_uuid_29526B260178FA14181170945919864;
>     type="application/xop+xml"; start="<
>     0.urn:uuid:29526B260178FA14181170945919865@apache.org
>     <ma...@apache.org>>";
>     start-info="text/xml"; charset=UTF-8
>
>     2495
>     --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
>     content-type: application/xop+xml; charset=UTF-8; type="text/xml";
>     content-transfer-encoding: binary
>     content-id: <0.urn:uuid:29526B260178FA14181170945919865@apache.org
>     <ma...@apache.org>>
>
>     <?xml version="1.0 " encoding="UTF-8"?><soapenv:Envelope
>     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><SendMms><xop:Include
>     href="cid: 1.urn:uuid:29526B260178FA14181170945919896@apache.org
>     <ma...@apache.org>"
>     xmlns:xop="http://www.w3.org/2004/08/xop/include
>     <http://www.w3.org/2004/08/xop/include>"></xop:Include>
>     <RequestElement>
>     .
>     .
>     .
>     </RequestElement></soapenv:Body></soapenv:Envelope>
>
>     --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
>     content-type: multipart/related;
>     .boundary="----=_Part_0_23276589.1170945917770"
>     content-transfer-encoding: binary
>     content-id: <1.urn:uuid:29526B260178FA14181170945919896@apache.org
>     <ma...@apache.org>>
>
>     ------=_Part_0_23276589.1170945917770
>     Content-Type: text/plain
>
>     first attachment
>
>     ------=_Part_0_23276589.1170945917770
>     Content-Type: image/jpeg
>     Content-Transfer-Encoding: base64
>     Content-Location: attach2.jpg
>     Content-Id: attach2.jpg
>
>     <content>
>     ------=_Part_0_23276589.1170945917770--
>
>
>
>     --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864--
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Problem retrieving ENABLE_MTOM value

Posted by donald yang <do...@googlemail.com>.
Hi, Maria,

    I am trying to send attachment to a web service using AXIS2-1.1.1. But
the binary data is sent by value not by reference. My client also enabled
MTOM and set optimization of OMText to TRUE. The only difference is that you
use createSoapMimeDataSource()( I don't know how you implement it), I
directly pass a  FILE variable. Could you please give me one complete
example how to sent attachment in client side? Sorry for interrupt you.

best regards
donald

On 2/8/07, Maria McCafferty <ma...@mobilecohesion.com> wrote:
>
> Hi,
>
> I am using Axis2 version 1.1.1. I have a client sending either and MTOM or
> SwA message. Here is part of the
> client code for sending an MTOM message:
>
>         ServiceClient service = new ServiceClient();
>         Options options = new Options();
>         options.setTo(targetEPR);
>         options.setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
>
>         service.setOptions(options);
>
>         OMElement payload = createPayload();
>
>         OMFactory fac = OMAbstractFactory.getOMFactory();
>
>         DataHandler dataHandler = new
> DataHandler(createSoapMimeDataSource());
>
>         OMText textData = fac.createOMText(dataHandler, true);
>
>         textData.setOptimize(true);
>
>         payload.addChild(textData);
>
>         OMElement res = service.sendReceive(payload);
>
> The SwA/MTOM request messages are fine and I am able to retrieve the
> attachments.
> As you can see, I set the property ENABLE_MTOM to true. However I am
> having problems retrieving
> the value from my server code. I am trying to access it by calling:
>
>         MessageContext.getCurrentMessageContext().isDoingMTOM()
>
> I thought this would return true given that the option was set in the
> Client. I have also checked the
> list of properties, and it is not included. I am getting the same problem
> when sending an SwA request -
> isDoingMTOM, isDoingSwA and isDoingREST are all set to false. I realise I
> can check the for the xop header,
> but felt that the above should work.
>
> Thanks,
> Maria
>
>
> POST /mm7 HTTP/1.1
>
> SOAPAction: "urn:anonOutInOp"
> User-Agent: Axis2
> Transfer-Encoding: chunked
> Content-Type: multipart/related;
> boundary=MIMEBoundaryurn_uuid_29526B260178FA14181170945919864;
> type="application/xop+xml"; start="<
> 0.urn:uuid:29526B260178FA14181170945919865@apache.org>";
> start-info="text/xml"; charset=UTF-8
>
> 2495
> --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> content-type: application/xop+xml; charset=UTF-8; type="text/xml";
> content-transfer-encoding: binary
> content-id: <0....@apache.org>
>
> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><SendMms><xop:Include
> href="cid:1.urn:uuid:29526B260178FA14181170945919896@apache.org"
> xmlns:xop="http://www.w3.org/2004/08/xop/include"></xop:Include>
> <RequestElement>
> .
> .
> .
> </RequestElement></soapenv:Body></soapenv:Envelope>
>
> --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864
> content-type: multipart/related;
> .boundary="----=_Part_0_23276589.1170945917770"
> content-transfer-encoding: binary
> content-id: <1....@apache.org>
>
> ------=_Part_0_23276589.1170945917770
> Content-Type: text/plain
>
> first attachment
>
> ------=_Part_0_23276589.1170945917770
> Content-Type: image/jpeg
> Content-Transfer-Encoding: base64
> Content-Location: attach2.jpg
> Content-Id: attach2.jpg
>
> <content>
> ------=_Part_0_23276589.1170945917770--
>
>
>
> --MIMEBoundaryurn_uuid_29526B260178FA14181170945919864--
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>