axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thilina Gunarathne" <cset...@gmail.com>
Subject Re: MTOM Support
Date Sun, 04 Nov 2007 20:51:26 GMT
Hi,
> When I monitor using tcpmon, I can see the multipart message. However,
> when I write the received OMElement on server to system err, I see the
> daat inlined in the SOAP body (I assume the toString on the OMElement
> just prints the logical model).
yes..It is.. Also it does not imply that the received message did not
have attachments.. We wanted that fact to be transparent to the
service..

thanks,
Thilina
>
> Thanks for your help.
>
> kind regards
> Meeraj
>
> On 11/4/07, Thilina Gunarathne <csethil@gmail.com> wrote:
> > What is the error you are getting with the following code... If you
> > can access the DataHandler without calling
> > "binaryNode.setBinary(true);" that means you are getting it..
> >
> > Also I do not understand wat you meant by XOP on the wire and non-XOP
> > when receiving it by the server, cause "on the wire" message is wat
> > the server receives..
> >
> > Thanks,
> > Thilina
> >
> > On 11/3/07, Meeraj Kunnumpurath <mkunnumpurath@googlemail.com> wrote:
> > > Hi,
> > >
> > > I can see on the wre (using tcpmon) the XOP include in the SOAP body,
> > > however, when I receive it on the server, the data seems to be
> > > inlined. The code I am using on the server is shown below,
> > >
> > >     public OMElement exchange(OMElement omElement) throws Exception {
> > >
> > >         try {
> > >
> > >             System.err.println(omElement);
> > >
> > >             OMText binaryNode = (OMText)
> > > (omElement.getFirstElement().getFirstElement().getFirstElement()).getFirstOMChild();
> > >             //binaryNode.setBinary(true);
> > >             DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler();
> > >
> > >             System.err.println("Data handler received");
> > >
> > >             InputStream in = dataHandler.getDataSource().getInputStream();
> > >             byte[] buffer = new byte[1024];
> > >             int read = in.read();
> > >
> > >             String data = new String(buffer, 0, read);
> > >             System.err.println(data);
> > >             System.err.println("After receiving data");
> > >
> > >             OMFactory fac = OMAbstractFactory.getOMFactory();
> > >
> > >             OMElement resp = fac.createOMElement("achnowledgement", null);
> > >             System.err.println(resp);
> > >
> > >             resp.setText(data + " acknowledged");
> > >
> > >             return resp;
> > >
> > >         } catch(Exception ex) {
> > >             ex.printStackTrace();
> > >             throw ex;
> > >         }
> > >
> > >     }
> > >
> > > Kind regards
> > > Meeraj
> > >
> > > On 11/3/07, Meeraj Kunnumpurath <mkunnumpurath@googlemail.com> wrote:
> > > > k, calling setOptimized(false) on OMText is creating the XOP include
> > > > and adding the data to a different mime part rather than inlining in
> > > > the SOAP body,
> > > >
> > > > POST /axis2/exchange HTTP/1.1
> > > > Content-Type: multipart/related;
> > > > boundary=MIMEBoundaryurn_uuid_B45C9BDDD05658F9E61194077083502;
> > > > type="application/xop+xml";
> > > > start="0.urn:uuid:B45C9BDDD05658F9E61194077083503@apache.org";
> > > > start-info="text/xml"
> > > > SOAPAction: "urn:anonOutInOp"
> > > > User-Agent: Axis2
> > > > Host: 127.0.0.1:8888
> > > > Content-Length: 832
> > > >
> > > > --MIMEBoundaryurn_uuid_B45C9BDDD05658F9E61194077083502
> > > > Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
> > > > Content-Transfer-Encoding: binary
> > > > Content-ID: <0.urn:uuid:B45C9BDDD05658F9E61194077083503@apache.org>
> > > >
> > > > <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> > > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><exchange><data><xop:Include
> > > > href="cid:1.urn:uuid:B45C9BDDD05658F9E61194077083558@apache.org"
> > > > xmlns:xop="http://www.w3.org/2004/08/xop/include"
> > > > /></data></exchange></soapenv:Body></soapenv:Envelope>
> > > > --MIMEBoundaryurn_uuid_B45C9BDDD05658F9E61194077083502
> > > > Content-Type: application/octet-stream
> > > > Content-Transfer-Encoding: binary
> > > > Content-ID: <1.urn:uuid:B45C9BDDD05658F9E61194077083558@apache.org>
> > > >
> > > > some dump data
> > > >
> > > > --MIMEBoundaryurn_uuid_B45C9BDDD05658F9E61194077083502--
> > > >
> > > > Now I need to figure out how to get the data handler on the server :)
> > > >
> > > > Ta
> > > > Meeraj
> > > >
> > > > On 11/3/07, Meeraj Kunnumpurath <mkunnumpurath@googlemail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > This is the output from tcpmon, the multipart message is created,
> > > > > however, the data is still inlined in the SOAP body.
> > > > >
> > > > > POST /axis2/exchange HTTP/1.1
> > > > > Content-Type: multipart/related;
> > > > > boundary=MIMEBoundaryurn_uuid_0ABA9A4117F4C627061194076883448;
> > > > > type="application/xop+xml";
> > > > > start="0.urn:uuid:0ABA9A4117F4C627061194076883449@apache.org";
> > > > > start-info="text/xml"
> > > > > SOAPAction: "urn:anonOutInOp"
> > > > > User-Agent: Axis2
> > > > > Host: 127.0.0.1:8888
> > > > > Content-Length: 503
> > > > >
> > > > > --MIMEBoundaryurn_uuid_0ABA9A4117F4C627061194076883448
> > > > > Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
> > > > > Content-Transfer-Encoding: binary
> > > > > Content-ID: <0.urn:uuid:0ABA9A4117F4C627061194076883449@apache.org>
> > > > >
> > > > > <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> > > > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><exchange><data>c29tZSBkdW1wIGRhdGEK</data></exchange></soapenv:Body></soapenv:Envelope>
> > > > > --MIMEBoundaryurn_uuid_0ABA9A4117F4C627061194076883448--
> > > > >
> > > > > Ta
> > > > > Meeraj
> > > > >
> > > > > On 11/3/07, Meeraj Kunnumpurath <mkunnumpurath@googlemail.com>
wrote:
> > > > > > Thanks Thilina. I am just printing the AXIOM message on the
server. I was
> > > > > > expecting to see the XOP include inside the SOAP body.
> > > > > >
> > > > > > Many thanks
> > > > > > Meeraj
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 11/3/07, Thilina Gunarathne <csethil@gmail.com> wrote:
> > > > > > > Hi,
> > > > > > > I could not find any obvious mistakes in your code..
> > > > > > >
> > > > > > > What is the tool you are using to trace the messages..
In case you are
> > > > > > > using SOAPMonitor,  it does not show attachments.. Try
using TCPMON
> > > > > > > (http://ws.apache.org/commons/tcpmon)..
> > > > > > >
> > > > > > > thanks,
> > > > > > > Thilina
> > > > > > >
> > > > > > > On 11/2/07, Meeraj Kunnumpurath < mkunnumpurath@googlemail.com>
wrote:
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > I have been looking at wiriting a client using AXIOM
for sending
> > > > > > > > binary attachments. The code is shown below,
> > > > > > > >
> > > > > > > >    public void testExchange() throws Exception {
> > > > > > > >
> > > > > > > >        DataHandler dataHandler = new DataHandler(new
FileDataSource("
> > > > > > > > Picture.jpg"));
> > > > > > > >
> > > > > > > >        OMFactory fac = OMAbstractFactory.getOMFactory();
> > > > > > > >
> > > > > > > >        OMElement request = fac.createOMElement("data",
null);
> > > > > > > >
> > > > > > > >        OMText binaryData = fac.createOMText(dataHandler,
true);
> > > > > > > >        binaryData.setOptimize (false);
> > > > > > > >
> > > > > > > >        request.addChild(binaryData);
> > > > > > > >
> > > > > > > >        OMElement method = fac.createOMElement("exchange",
null);
> > > > > > > >        method.addChild(request);
> > > > > > > >
> > > > > > > >        Options options = new Options();
> > > > > > > >        options.setTo(new
> > > > > > > >
> > > > > > EndpointReference("http://localhost:8900/axis2/exchange"));
> > > > > > > >
> > > > > > > > options.setProperty(Constants.Configuration.ENABLE_MTOM
> > > > > > ,
> > > > > > > > Constants.VALUE_TRUE );
> > > > > > > >
> > > > > > > >        ServiceClient sender = new ServiceClient();
> > > > > > > >        sender.setOptions(options);
> > > > > > > >
> > > > > > > >        sender.sendReceive(method);
> > > > > > > >
> > > > > > > >    }
> > > > > > > >
> > > > > > > > Unfortunately, the message is being sent to the server
inlined without
> > > > > > > > any mime parts. I have tried SWA instead of MTOM,
but the same result.
> > > > > > > > Any pointers would be highly appreciated. The message
trace for
> > > > > > > > request is shown below,
> > > > > > > >
> > > > > > > > <?xml version='1.0' encoding='utf-8'?>
> > > > > > > > <soapenv:Envelope
> > > > > > > >
> > > > > > > > xmlns:soapenv="
> > > > > > http://schemas.xmlsoap.org/soap/envelope/">
> > > > > > > > <soapenv:Body>
> > > > > > > >    <exchange>
> > > > > > > >      <data>/9j/4RBZRXhpZgA.....38z/2Q==</data>
> > > > > > > >    </exchange>
> > > > > > > > </soapenv:Body>
> > > > > > > > </soapenv:Envelope>
> > > > > > > >
> > > > > > > > Kind regards
> > > > > > > > Meeraj
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Thilina Gunarathne  - 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  - 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  - 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


Mime
View raw message